Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EI2223Q1ADAF3 - LOGGING

There is a row of precious timber forests of n trees numbered from 1 to n and each tree has a monetary value of k. Phuc wants to cut some trees to get the maximum values and with the following conditions:

  • Always cut at least two consecutive trees. It means that if you cut a tree, at least one of the next or the previous trees must be cut.
  • There are some trees of the rare species with the value k < 0, if the Beo is cut down, he will be fined an amount of money that is equal to the absolute value of that tree.

Input

The first line contains a single integer n (1≤ n ≤ 105)
The next line contains n integers ki (1≤ i ≤ n , |k| ≤ 109) -value of each tree.

Output

Print the maximum value he can get.

Sample

Input

Output

9

3 1 3 -8 3 -2 2 -1 3

12

 


Added by:Ha Minh Ngoc
Date:2022-12-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.