AFA Function

AFA Function

Time limit 1 second
Memory limit 64 MiB

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

Input data

The inputs are two lines: the first contains the number N (1N2000), the second - a sequence of N numbers. The value of any element of a sequence to the module does not exceed 100. The numbers are separated by spaces.

Output data

Bring minimum of AFA.


Input example #1
1 5
Output example #1
Source The 2012 All-Ukrainian Collegiate Programming Contest Round I Training Contest 19 April 2012