Castaways

Alexa and Bob are castaways survived to a shipwreck arriving to a lonely island. This island is relatively near to the mainland but there is no easy way to send an alarm message to tell what happened. Alexa and Bob arrived to the island coast clinging to a wooden cargo box that -besides being a lifesaver- contained a lot of wooden sticks of different sizes and a fabric roll. Since they are experimented windsurfers, they are planning to build two windsurf boards that they could use to get off the island sailing to mainland. Each windsurf board may be made with a side plank of the wooden box. And the board must be propelled by the wind, so that they want to build sails for the two boards. The sails may be constructed with some wooden sticks forming a frame and a piece of fabric from the roll. But in order to build a wind-surf sail, Alexa prefers a triangular one and Bob a rectangular one. There are arguments to support that triangles are better than rectangles when one talks about windsurf sails, and now it is not possible that Alexa and Bob come to a common solution. They know, however, that it is better to build sails with a big area, so that the wind may propel the board more effectively. To avoid further discussions they come to the next problem to solve: design the largest pair of triangular and rectangular sails, given the sizes of the wooden sticks (there is enough fabric in the roll to make any sail). When they say “the largest pair” they mean a triangle and a rectangle whose areas, together, are as big as possible. Note that it can be that such a maximal pair could be formed by a triangle and a void rectangle, by a void triangle and a rectangle, or by a void triangle and a void rectangle, because in this way the total area may be maximized. Lets illustrate the situation with some examples. Suppose first that the box contains only 3 sticks, of lengths 3, 4 and 5 cm. Then the castaways can build only a triangular sail, with area 6 cm2. And if the box contains 7 sticks, of lengths 1, 4, 2, 1, 3, 3, 2 cm, they may build a pair consisting of a rectangular sail of 6 cm2 and a void triangle. Finally, if there are 9 sticks in the box, each one of length 10 cm, they can build an equilateral triangle and a square as their largest pair, with total area 143 cm2 (neglecting fractions of cm2). You must write a program to help the castaways design their sails. Input The input consists of several test cases. The first line of each test case contains a single integer N indicating the number of wooden sticks in the box (3 ≤ N ≤ 256). Then there are N lines, each one with one single integer x (1 ≤ x ≤ 256), representing the sizes of the N wooden sticks, measured in centimeters. Output For each test case, print a single line with an integer indicating the area of the largest pair (as defined above), in squared centimeters (neglecting decimals), that may be constructed with the N given sticks. Sample Input 3 3 4 5 7 1

2/2 4 1 2 3 2 3 9 10 10 10 10 10 10 10 10 10 3 1 1 8 Sample Output 6 6 143 0