Go Back
Convincing Rahul (100)

Suriya is the head of an event in Cognition and he is convincing Rahul to participate in the event.
But as we all know, Rahul is very good at ignoring events. He wishes to sleep for 3 days instead of visiting the college during Cognition. But as Suriya is his friend, Rahul would participate only if Suriya solves the following puzzle.

Rahul has given 3 numbers A, B and C. Suriya is supposed to insert two operators between them in order to form an expression. Let the value of this expression be Y.
i.e. A ( operator 1 ) B ( operator 2 ) C = Y
These operators can only either be addition ( + ) or multiplication ( * ).
Suriya has freedom to insert any operator wherever he wishes. He is also allowed to insert the same operator twice.

In order to solve the puzzle Suriya has to find the maximum possible value of Y.
Help Suriya in solving the puzzle.

( NOTE : In case where both the operators are used, use BODMAS to calculate the value of Y. i.e. Multiplication should be performed before addition. )


The first line of the input consists of a single integer T, denoting the number of Test Cases.
Each test case consists of a single line containing 3 space-separated integers A B and C.


For each test case, output a single line consisting of a single integer, the maximum possible value of Y.


1 <= T <= 1000
0 <= A, B, C <= 1000

Copy Input

2 2 3
3 2 4



Test Case 1 :
The maximum value of Y can be obtained by the following equation :
2 * 2 * 3 = 12

Single Round Match #03
3 hour contest

First 4 submissions made at the start are rejudged :)

Problem Tags

Supported by our Coding Partner