• # For Solution

Chef has NN slippers, LL of which are left slippers and the rest are right slippers. Slippers must always be sold in pairs, where each pair contains one left and one right slipper. If each pair of slippers cost XX rupees, what is the maximum amount of rupees that Chef can get for these slippers?

## Chef and Pairing Slippers solution codechef

• The first line contains TT – the number of test cases. Then the test cases follow.
• The first line of each test case contains three space-separated integers NNLL, and XX – the total number of slippers, the number of left slippers, and the price of a pair of slippers in rupees.

## Chef and Pairing Slippers solution codechef

For each test case, output on one line the maximum amount of rupees that Chef can get by selling the slippers that are available.

## Chef and Pairing Slippers solution codechef

• 1T1031≤T≤103
• 0LN1030≤L≤N≤103
• 0X1030≤X≤103

## Chef and Pairing Slippers solution codechef

4
0 0 100
10 1 0
1000 10 1000
10 7 1


## Chef and Pairing Slippers solution codechef

0
10000
3


### Explanation

• Test case 11: Chef has no pairs to sell, so the amount obtained is 00.
• Test case 22: The amount earned by selling a pair is 00, so the total amount obtained is 00.
• Test case 33: Chef can sell 1010 pairs of slippers, each giving 10001000 rupees, so the total amount earned is 100010=100001000⋅10=10000.
• Test case 44: Chef has 1010 slippers of which 77 are left and 33 are right. Therefore Chef can sell a maximum of 33 pairs and in total can get at most 31=33⋅1=3.