F. Fixture
time limit per test
0.5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

Mati has the results of the $$$N$$$ matches he played during the last league of virtual tennis, an individual sport where there are no ties, meaning that in each match a player either wins or loses.

The league organization has a certain fascination with streaks, and the way to obtain a player's final score is somewhat peculiar. A player earns one point for each match won and loses one point for each match lost. Additionally, if after finishing a match a player has at least 3 consecutive matches won including the last match, then they receive an additional point.

Can you help Mati calculate how many points he obtained?

Input

A line with an integer $$$N$$$ $$$(1 \leq N \leq 100)$$$, the number of matches Mati played in the virtual tennis league.

Then a line with $$$N$$$ numbers $$$R_1, R_2, \dots, R_N$$$ $$$(R_i \in \{0, 1\})$$$, where $$$R_i = 0$$$ if Mati lost the $$$i$$$-th match in chronological order and $$$R_i = 1$$$ if Mati won the $$$i$$$-th match.

Output

A line with an integer indicating the points Mati obtained at the end of his matches in the league.

Examples
Input
8
1 0 1 0 1 0 1 0
Output
0
Input
5
0 0 0 0 0
Output
-5
Input
5
1 1 1 1 1
Output
8
Input
7
1 1 1 0 1 1 1
Output
7
Note

In the first example, there is no streak of 3 matches or more, and Mati wins and loses the same number of matches, obtaining $$$0$$$ points.

In the second example, Mati loses all the matches, obtaining $$$-5$$$ points.

In the third example, Mati wins all the matches, obtaining $$$8$$$ points.

In the fourth example, Mati obtains $$$7$$$ points, as he earns $$$2$$$ additional points for the consecutive matches won at the end of the third and seventh matches.