Question
Silent Museum Guard

A museum has N rooms in a row. Room i contains artifacts worth A_i.

A silent guard can inspect any set of rooms, but cannot inspect two adjacent rooms because the alarm sensors of neighboring rooms interfere with each other.

Find the maximum total artifact value the guard can inspect.

The hidden idea: for every room, there are only two meaningful states — take it or leave it.

Input

The first line contains an integer KaTeX can only parse string typed expression.

The second line contains KaTeX can only parse string typed expression integers KaTeX can only parse string typed expression.

Output

Print a single integer — the maximum total value that can be inspected.

Example
Example 1:
Input
5

2 7 9 3 1
Output
12
Explanation
Inspect rooms KaTeX can only parse string typed expression for total value KaTeX can only parse string typed expression.

Example 2:
Input
4

5 1 1 5
Output
10

Online