Time limit
1s
Memory limit
128 MB
The stair-climbing game starts below the stairs and ends at the final stair at the top. Each stair has a score written on it, and stepping on that stair earns that score.

For instance, if you step on the 1st, 2nd, 4th, and 6th stairs as in <Figure 2>, the total score is 10 + 20 + 25 + 20 = 75.

You must follow these rules when climbing.
Therefore, after stepping on the 1st stair, you may move to the 2nd or 3rd stair. You cannot move directly from the 1st stair to the 4th stair, and you cannot step on the 1st, 2nd, and 3rd stairs all consecutively.
Given the scores written on the stairs, compute the maximum total score you can obtain.
The first line contains the number of stairs N.
Starting from the second line, N lines follow. Each line contains the score written on one stair, in order from the bottom stair to the top stair. N is a positive integer at most 300, and each score is a positive integer at most 10,000.
Print the maximum total score obtainable while following the rules and stepping on the final stair.