Seesaw

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

A straight stick of length 10910^9 is placed from the left to the right. You can ignore the weight of the stick. In total, NN unit weights are attached to the stick. The positions of the NN weights are different from each other. The position of the ii-th weight (1iN1 ≤ i ≤ N) is A_iA\_i , i.e., the distance between the ii-th weight and the leftmost end of the stick is A_iA\_i.

In the beginning, we have a box of width ww. We place the stick on the box so that the box supports the range from ll to rr of the stick (0l<r1090 ≤ l < r ≤ 10^9), inclusive, i.e., the range of the stick from the point whose position is ll to the point whose position is rr. Here, r=l+wr = l + w is satisfied. We cannot change the values of ll and rr afterward.

Next, among the weights attached to the stick, we remove the leftmost one or the rightmost one. We shall repeat this operation N1N - 1 times. In this process, including the initial state and the final state, the barycenter of the weights attached to the stick should remain in the range from ll to rr, inclusive. Here, if mm weights are attached to the stick whose positions are b_1,b_2,,b_mb\_1, b\_2, \dots , b\_m, the position of the barycenter is b_1+b_2++b_mm\frac{b\_1+b\_2+\cdots +b\_m}{m}.

Given the number of weights NN and the positions of the weights A_1,A_2,,A_NA\_1, A\_2, \dots , A\_N, write a program which calculates the minimum possible width ww of the box.

입력

Read the following data from the standard input. Given values are all integers.

NN

A_1,A_2,,A_NA\_1, A\_2, \cdots , A\_N

출력

Write one line to the standard output. The output should contain the minimum possible width ww of the box. Your program is considered correct if the relative error or the absolute error of the output is less than or equal to 0.000,000,0010.000\\,000\\,001 (=109= 10^{-9}). The format of the output should be one of the following.

  • Integer. (Example: 123, 0, -2022)
  • A sequence consisting of an integer, the period, a sequence of numbers between 00 and 99. The numbers should not be separated by symbols or spaces. There is no restriction on the number of digits after the decimal point. (Example: 123.4123.4, -123.00123.00, 0.002880.00288)

제한

  • 2N200,0002 ≤ N ≤ 200\\,000.
  • 0A_1<A_2<<A_N1,000,000,0000 ≤ A\_1 < A\_2 < \cdots < A\_N ≤ 1\\,000\\,000\\,000 (=109= 10^9).