The first line contains an integer $n$: the number of pairs of boards ($2 \le n \le 7$).

The second line contains $n$ integers: the lengths of boards in the first, second, \ldots, $n$-th pair.
Each length is an integer from $1$ to $10^8$.