12509 - I, THIEF   

Description

You are a thief, a thief try hard to steal money along street as much as you can.

However, if you steal two adjacent house is very easy to alert the police, a situation you should avoid.

 

HINT: If you get TLE, you can try to save the subproblem answer. Then next time, if you want to use it, no need to repeat same work.

Input

N

S_i

 

N is the number of house. 0<N<=100

S_i is representing the amount of money of each house, money amount is no more than 10000

Output

M

 

M is the  maximum amount of money you can rob tonight without alerting the police.

make sure there is a trailing space followed by it.

Sample Input  Download

Sample Output  Download

Tags




Discuss