12525 - I, THIEF, Circle   

Description

It's time to steal money again, still, try hard to steal money along street as much as you can and please avoid steal two adjacent houses.

However, target tonight is a little different. All houses at this place are arranged in a circle.

That is, you can't steal money from first and last house simultaneously.

 

Input

N

S_i

 

N is the number of house. 2<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