시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB83504663.014%

문제

Maarja wants to buy a rectangular piece of land and then construct three buildings on that land.

The boundaries of the buildings on the ground must have rectangular sizes a1 × b1, a2 × b2, and a3 × b3. They can touch each other but they may not overlap. They can also be rotated as long as their sides are horizontal and vertical.

What is the minimum area of land Maarja has to buy?

Figure B.1: Illustration of the two test scenarios in Sample Input 1 and their solutions. In the second scenario the 5 × 1 building has been rotated by 90 degrees.

입력

The input consists of multiple test scenarios. The first line of input contains a single integer t (1 ≤ t ≤ 1000), the number of scenarios. Then follow the t scenarios. Each scenario consists of a single line, containing six integers a1, b1, a2, b2, a3 and b3 (1 ≤ a1, b1, a2, b2, a3, b3 ≤ 109).

출력

For each test scenario, output the minimum area of land such that Maarja can construct the three buildings.

예제 입력 1

2
2 3 2 2 1 1
2 4 5 1 2 3

예제 출력 1

12
21

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2019 B번

  • 문제를 만든 사람: Antti Laaksonen