Insulator
The company Insumax produces multilayer thermal insulators. Each of
the
heat ->
||
The insulation coefficient of the whole insulator,
For example, the insulation coefficient of the insulator of the form -> || 5 | 4 | 1 | 7 || ->
is ## TaskWrite a program which, for given insulation coefficients of layersa_{1}, a_{2}, ..., a,
determines such an ordering of the layers that the insulation
coefficient of the whole insulator is maximised.
_{n}## InputIn the first line of the text fileizo.in there is the number
of layers n, 1 <= n <= 100000. In the successive
n lines there are coefficients a_{1},
a_{2}, ..., a, one per line. Those
coefficients are integers satisfying the inequalities 1 <=
_{n}a <= 10000.
_{i}## OutputIn the first and only line of the text fileizo.out your
program should write one integer equal to the largest possible value
of the insulation coefficient A of the insulator built of the
layers of the given coefficients, put in a particular order.
## ExampleFor the following input fileizo.in:
4 5 4 1 7the correct answer is in the following output file izo.out:
24 |