H. Driving restriction schedule
time limit per test
0.25 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

Reinaldo is a driver who works in the city of São Paulo, starting his demanding routine every day at 5:00 AM. He must visit $$$N$$$ different locations in order to complete his work. Despite São Paulo's traffic, Reinaldo always takes the same amount of time: $$$T_1$$$ minutes to travel from his home to the first location, $$$T_2$$$ minutes to travel from the first location to the second, and so on.

The problem is that on one day of the week, the city of São Paulo enforces a vehicle restriction system based on license plate numbers. Under this system, Reinaldo is not allowed to drive between 7:00 AM and 10:00 AM, nor between 5:00 PM and 8:00 PM. Whenever one of these restricted periods begins while Reinaldo is driving, he must stop his car wherever he is and resume driving only after the restriction period ends.

Can you help Reinaldo determine how long it will take him to complete his work routine on a day when the license plate restriction is in effect?

Input

The first line contains an integer $$$N$$$ ($$$1 \leq N \leq 12$$$).

The second line contains $$$N$$$ integers $$$T_i$$$ ($$$1 \leq T_i \leq 120$$$ minutes), representing the travel times between consecutive locations.

Output

The output should contain a single line with an integer representing the number of minutes Reinaldo takes to complete his work routine.

Examples
Input
3
60 30 30
Output
120
Input
3
60 30 31
Output
301
Input
5
70 60 30 40 30
Output
410
Input
6
100 100 100 100 100 100
Output
960
Note

Explanation of Sample 1: The three trips take a total of 2 hours (120 minutes). Therefore, Reinaldo starts at 5:00 AM and finishes at 7:00 AM without having to stop because of the driving restriction.

Explanation of Sample 2: The three trips take a total of 121 minutes, forcing Reinaldo to stop during the restriction period between 7:00 AM and 10:00 AM. As a result, the total time becomes 301 minutes.