- rectangle edges are parallel to the coordinate axes;
- the y-coordinates of lower horizontal edges are distinct and assume the following values:
; - the lowest rectangle's lower left corner has coordinates
, while the lower right corner coincides with the origin.

The
The
In other words, the mass of each rectangle is multiplied by its
An arrangement is stable if, for each rectangle
- the
-barycentre of rectangles above has distance of at most from the -centre of (i.e. is contained in the x-interval that covers ).
Intuitively, stability of an arrangement can be understood as the precondition for the arrangement to
not fall apart. The arrangement in the figure on the left is unstable since the
Given the masses of all rectangles, find the largest ("rightmost") possible x-coordinate of any rectangle corner in a stable arrangement. You are not allowed to change the order of rectangles (they are given from the lowest to the highest one).
Input Specification
The first line of input contains the positive integer
Each of the next
Output Specification
The first and only line of output must contain the required rightmost x-coordinate. The given result
must be within
Scoring
In test cases worth
Sample Input 1
2
1
1
Sample Output 1
1.000000
Sample Input 2
3
1
1
1
Sample Output 2
1.500000
Sample Input 3
3
1
1
9
Sample Output 3
1.900000
Comments