#P153. 练25.2 订餐时间
练25.2 订餐时间
Description
Xiaoming is organizing a high school class reunion. He needs to leave home and visit n hot pot restaurants in order to decide which one is more suitable for a large group dinner. After leaving the nth restaurant, he will immediately decide on the venue for the dinner.
He wants to know how much total time he spent from leaving home until leaving the nth restaurant (ignoring the time spent inside the restaurants).
Input Format
The first line contains an integer n ().
The second line contains n space-separated integers a_i (), where the first integer represents the time needed to travel from Xiaoming's home to the first restaurant, and the i-th integer represents the time needed to travel from the (i-1)th restaurant to the i-th restaurant.
All input numbers are positive integers and satisfy x≤n.
Output Format
An integer representing the total time spent.
Sample
4
1 2 3 410