Yo`nalishlar
Hozirda online

Statistika

Masalalar soni: 909

Foydalanuvchilar soni: 8819

Jo'natishlar soni: 714318

Muhokama yozuvlari: 4540

Yangiliklar soni: 97

Yangiliklar izohlari: 1174


So'ngi izohlar

712. AFA Function
Vaqt limiti: 1 sekund
Xotira limiti: 64 MB

   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 1 ≤ i ≤ j ≤ n. Find the minimum of the function.

   Input

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

   Output

   Bring minimum of AFA.

Samples

Input

Output

1

2

1 5

1

2

3

-5 3 -7

-9

 

Tayyorladi: Azat Yusupov
Text from: e-olimp.com
Mening urinishlarim(0) Muhokama (0) Jo'natish Eng yaxshi yechimlar Barcha muvaffaqiyatli urinishlar(43) Barcha urinishlar(82)