#D8970. Maximization of Rational Expression
Maximization of Rational Expression
Maximization of Rational Expression
N different natural numbers are given. If you select four different ones and set them as , , , , the following formula
I want to find the maximum value of.
Given N different natural numbers, choose 4 different from them and create a program to find the maximum value of the above formula.
Input
The input is given in the following format.
N a1 a2 ... aN
The number N (4 ≤ N ≤ 1000) of natural numbers is given in the first line. The value ai (1 ≤ ai ≤ 108) of each natural number is given in the second line. However, the same natural number does not appear more than once (ai ≠ aj for i ≠ j).
Output
Outputs the maximum value of the above formula as a real number for a given N natural numbers. However, the error must not exceed plus or minus 10-5.
Examples
Input
10 1 2 3 4 5 6 7 8 9 10
Output
19.00000
Input
5 22 100 42 3 86
Output
9.78947
Input
6 15 21 36 10 34 5
Output
18.00000
Input
4 100000 99999 8 1
Output
28571.285714
inputFormat
Input
The input is given in the following format.
N a1 a2 ... aN
The number N (4 ≤ N ≤ 1000) of natural numbers is given in the first line. The value ai (1 ≤ ai ≤ 108) of each natural number is given in the second line. However, the same natural number does not appear more than once (ai ≠ aj for i ≠ j).
outputFormat
Output
Outputs the maximum value of the above formula as a real number for a given N natural numbers. However, the error must not exceed plus or minus 10-5.
Examples
Input
10 1 2 3 4 5 6 7 8 9 10
Output
19.00000
Input
5 22 100 42 3 86
Output
9.78947
Input
6 15 21 36 10 34 5
Output
18.00000
Input
4 100000 99999 8 1
Output
28571.285714
样例
5
22 100 42 3 86
9.78947