#P8585. Max Reputation of Ellipsoidal Sprites

    ID: 21751 Type: Default 1000ms 256MiB

Max Reputation of Ellipsoidal Sprites

Max Reputation of Ellipsoidal Sprites

You have discovered a new species called ball‐shaped sprites in the Tripeleaf Nebula of Sagittarius. Each sprite is shaped like a standard ellipsoid and has three dimensions (amplitudes) \(\{r_1, r_2, r_3\}\) corresponding to its scale in three independent directions in space.

There is a legend among the sprites: the one with the highest reputation in the tribe will be granted the opportunity to ascend to the four-dimensional universe. The reputation \(\rho\) of a sprite with amplitudes \(\{r_1, r_2, r_3\}\) is defined as

[ \rho = \left\lfloor\frac{1}{4}\min{r_1, r_2, r_3}^3\right\rfloor, ]

where \(\lfloor \cdot \rfloor\) denotes the floor function.

Furthermore, each sprite is allowed to embrace at most once with another sprite. When two sprites embrace they merge to form a new sprite and neither of the original sprites can be used in further embraces. Two sprites can embrace if and only if they have at least one amplitude face in common – that is, they must have at least two equal amplitude values (order is irrelevant because sprites can be arbitrarily rotated). For example, if one sprite has amplitudes \(\{a, x, y\}\) and another has amplitudes \(\{b, x, y\}\), then they can embrace to form a new sprite with amplitudes \(\{a+b, x, y\}\>.

Your task is to determine the highest possible reputation value that can be achieved by any sprite in the tribe after optionally performing one merge.

inputFormat

The input begins with a single integer \(n\) \( (1 \le n) \) representing the number of sprites. Each of the following \(n\) lines contains three positive integers \(r_1\), \(r_2\), and \(r_3\) representing the amplitudes of a sprite.

You may assume that the amplitudes are positive integers.

outputFormat

Output a single integer: the maximum possible reputation value achievable. This value can come either from one of the original sprites or from a new sprite created by merging any two sprites (each sprite can merge at most once, and the newly formed sprite cannot merge further).

The reputation \(\rho\) of any sprite with amplitudes \(\{r_1, r_2, r_3\}\) is computed as:

[ \rho = \left\lfloor \frac{\min{r_1, r_2, r_3}^3}{4} \right\rfloor. ]

</p>

sample

3
1 10 10
2 10 10
3 4 5
6