Submit | All submissions | Best solutions | Back to list |
TCCCCCC1 - Add and Multiply |
Given three integers A, B, C, you are allowed to perform exactly two operations on these numbers: an addition and a multiplication.
For instance, if A = 10, B = 3, C = 2, we can get (10 + 2) * 3 = 36.
What are the minimum and maximum values you can get by applying these two operations?
Input
The first line of input contains T (1<= T <= 200), the number of test cases to consider.
Each of the next T lines contains three integers A, B, and C (where -1,000,000 <= A, B, C <= 1,000,000).
Output
For each test case, output a line with the minimum and maximum values described in the statement.
Sample
Input 2 10 3 2 -3 2 -5 Output 16 50 -16 17
Added by: | kojak_ |
Date: | 2013-05-05 |
Time limit: | 3s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |