MGSINFOA - Big J Walks Around the school

Big J needs to walk around the school, visiting multiple locations such as the main oval, the science hub, the music school, the library, etc. He is a very busy man and therefore needs to accurately plan out his schedule.

You, as his number one student, will need to help him calculate how long it will take for him to walk around the school.

You will be given a list of times, showing how long it takes for Big J to travel between 2 locations.

Input

The input will be of 2 lines.

The first line will contain an integer N (1 ≤ N ≤ 105), the number of stops he is going to stop at.

The second line will contain an array A of N - 1 integers (1 ≤ Ai ≤ 60), each showing the minutes required to move between 2 locations.

Output

Output a single integer, the total amount of time required for him to get from the first location to the last.

Example

Input:
5
3 8 1 3

Output:
15

Added by:OuiOuiBaguette
Date:2025-08-06
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2025-08-24 16:20:53 Simes
Add up the numbers? Should be in basics.
2025-08-23 06:55:53
It is not classical problem
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.