logo AlgoBeat OnlineJudge
登录 注册

#217133. [ICPC 2017 Urumqi R] The Difference

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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 and , with the maximum value of .

输入格式

The input contains several test cases and the first line provides an integer indicating the number of cases.

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

All integers are positive and not greater than .

输出格式

For each test case, output a line with a single integer, the maximum value of .

样例

样例输入 1

5
1 2 3 4
2 2 2 2
7 4 3 8
100 99 98 97
100 100 1 2

样例输出 1

10
0
44
394
9998