Davis who has number of scanners in his shop select only two scanners to scan the documents of a customer. When a customer comes to his shop he knows three parameters S1, S2 and N. S1 and S2 are the time taken by scanner 1 and scanner 2 to scan one document respectively And N is the number of documents given by the customer. As he is suppose to entertain a number of customers, he wants to calculate the minimum time to scan all the N documents using those two scanners.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains three space separated integers S1, S2 and N.
In new line, print the minimum time required.
1 <= T <= 500
1 <= S1,S2,N <= 106
2 4 2
1 2 2
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.