Candy Totals
View as PDFJustin has just bought some halloween candy for  days (only for himself to eat, of course) and he has already planned out how many candies to eat each day. However, he wants to know how many candies he will eat in total for the first 
 days. Can you figure it out for him?
Input Specification
The first line will have integer , the number of days that Justin bought candy for. There will be between 
 and 
 days, inclusive.
The next  lines will have one integer each, representing how many candies he eats on that specific day. These values will also be in between 
 and 
, inclusive.
The final line will have integer , the value that you will use to answer Justin's question. This value will be between 
 and 
, inclusive.
Output Specification
One integer, the total number of candies he will eat for the first  days.
Sample Input 1
7
3
6
4
9
2
0
10
4
Sample Output 1
22
Sample Explanation 1
For the first  days, Justin eats 
, 
, 
, and 
 candies, so the total number of candies he eats in these days would be 
.
Sample Input 2
6
9
9
2
5
4
8
2
Sample Output 2
18
Sample Explanation 2
On the first day, Justin eats  candies, and on the second day he also eats 
 candies so he eats a total of 
 candies.
Comments