#P17260. [ICPC 2017 Urumqi R] The Difference

[ICPC 2017 Urumqi R] The Difference

题目描述

Alice was always good at math. Her only weak points were multiplication and subtraction. To help her with that, Bob presented her with the following problem.

He gave her four positive integers. Alice can change their order optionally. Her task is to find an order, denoted by A1,A2,A3A_1, A_2, A_3 and A4A_4, with the maximum value of A1×A2−A3×A4A_1 \times A_2 - A_3 \times A_4.

输入格式

The input contains several test cases and the first line provides an integer t(1≤t≤100)t (1 \le t \le 100) indicating the number of cases.

Each of the following tt lines contains four space-separated integers.

All integers are positive and not greater than 100100.

输出格式

For each test case, output a line with a single integer, the maximum value of A1×A2−A3×A4A_1 \times A_2 - A_3 \times A_4.

5
1 2 3 4
2 2 2 2
7 4 3 8
100 99 98 97
100 100 1 2
10
0
44
394
9998