AFA Function#3256

AFA Function

1 second
64 megabytes
Very easy

Given a sequence of integers. By definition, \text{AFA}(i, j) is the sum of all elements of the specified sequence between the indices and , inclusive, for 0 \le i \le j < n. Find the minimum of the function.

Input

The inputs are two lines: the first contains the number (1 \le N \le 2000), the second - a sequence of numbers. The absolute value of any element of the sequence does not exceed . The numbers are separated by spaces.

Output

Output the minimum of .

Examples

Example 1

Loading
Loading