LearnPy Hub
← Arena
IntermediateRating 1200

Don't Rob Neighbours

Houses in a row hold money; you can't take from two adjacent houses. Print the maximum you can take.

Input

n, then n values.

Output

A number.

Sample 1

Input
4
1 2 3 1
Output
4

Sample 2

Input
5
2 7 9 3 1
Output
12
solution.py
Output appears here
Don't Rob Neighbours · Python Arena problem · LearnPy Hub