Julia received a really simple function, , for her birthday! The function is defined as:
Julia wants your help finding the triplet so she can calculate the value of . If there is more than one such triplet, then she always chooses the one with the smallest value of ; if there are still many such triplets, then she chooses the one with the smallest value of .
You are given queries, where each query consists of , , , , and . For each query, find the value of and print it on a new line, where is defined as:
Note: It is guaranteed that the triplet always exists for the given values of , , and .
Input Format
The first line of the input contains an integer, , denoting the number of queries.
Each of the subsequent lines contains five space-separated integers describing the respective values of , , , , and for a query.
Constraints
Output Format
For each query, print the value of on a new line.
Sample Input 0
4
14 36 98 5 6
49 251 1393 7 10
14 36 98 6 9
49 251 1393 8 8
Sample Output 0
1070
72592824
30124
1686433
Explanation 0
The breakdown below describes the first and last queries:
, , , , and
For this query, the triplet is . From this, we calculate:We then print the value of on a new line., , , , and
For this query, the triplet is . From this, we calculate:
We then print the value of on a new line.