Masha and her grandmother are playing dice. The girl throws the dice and announces the number that appears on it. The grandmother is very old and has poor eyesight, but she can hear everything. Masha can distort the result of any dice throw. For example, if the dice show $$$2$$$, and Masha says $$$5$$$, then the result will be $$$5$$$. However, if the grandmother hears three sixes in a row, she takes a magnifying glass and checks only the last throw, after which the number of consecutive sixes is reset.
Masha loves her grandmother very much and does not want to upset her, but at the same time she dreams of scoring the maximum number of points. Help Masha to score the maximum number of points without getting caught by her grandmother.
The first line contains the number of throws $$$n$$$ ($$$1 \le n \le 10^{5}$$$).
The next line contains $$$n$$$ values $$$a_{i}$$$ ($$$1 \le a_{i} \le 6$$$) - the actual number of points on the dice after the $$$i$$$-th throw.
Output a single number - the maximum sum of points that Masha can score.
31 1 6
18
32 3 5
17
| Name |
|---|


