You are given an \(n\times n\times n\) big three-dimensional cube that contains \(n^3\) numbers. You have to choose \(n\) of those numbers so that their sum is as small as possible. It is, however, forbidden to choose two numbers that are located in the same plane. That is, if we identify the positions in the cube by three Cartesian coordinates, then choosing two numbers from positions \((x,y,z)\) and \((x',y',z')\) is forbidden if \(x=x'\), \(y=y'\), or \(z=z'\).
Output
The output consists of a single number. It is the minimum sum of \(n\) numbers chosen from the cube according to the above rules.
Примеры
| № | Входные данные | Выходные данные |
|
1
|
3 1 2 3 4 5 6 7 8 9 1 1 1 2 2 2 3 3 3 4 3 0 2 1 4 9 8 9
|
5
|