100 atcoder#ABC050B. [ABC050B] Contest with Drinks Easy
[ABC050B] Contest with Drinks Easy
Score : points
Problem Statement
Joisino is about to compete in the final round of a certain programming competition. In this contest, there are problems, numbered through . Joisino knows that it takes her seconds to solve problem .
Also, there are kinds of drinks offered to the contestants, numbered through . If Joisino takes drink , her brain will be stimulated and the time it takes for her to solve problem will become seconds. It does not affect the time to solve the other problems.
A contestant is allowed to take exactly one of the drinks before the start of the contest. For each drink, Joisino wants to know how many seconds it takes her to solve all the problems if she takes that drink. Here, assume that the time it takes her to solve all the problems is equal to the sum of the time it takes for her to solve individual problems. Your task is to write a program to calculate it instead of her.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
For each drink, calculate how many seconds it takes Joisino to solve all the problems if she takes that drink, and print the results, one per line.
3
2 1 4
2
1 1
2 3
6
9
If Joisino takes drink , the time it takes her to solve each problem will be , and seconds, respectively, totaling seconds.
If Joisino takes drink , the time it takes her to solve each problem will be , and seconds, respectively, totaling seconds.
5
7 2 3 8 5
3
4 2
1 7
4 13
19
25
30