## CCO '03 P2 - Concentration Cards

View as PDF

Points: 15
Time limit: 1.0s
Memory limit: 16M

Problem type
##### 2003 Canadian Computing Competition, Stage 2

Stan has a deck of Concentration Cards. He wants to lay the cards edge-to-edge to form a filled rectangle with minimal perimeter. Each card is a rectangle with dimensions mm. by mm.

Figure 1: Concentration Cards

#### Input Specification

The first line of input contains , the number of test cases. For each case there is an additional line containing , , , each a positive integer not exceeding .

#### Output Specification

Your program should produce one line of output per case, giving the minimal perimeter.

#### Sample Input

3
3 300 400
4 400 300
7 300 400

#### Sample Output

2600
2800
3800