Олимпиадный тренинг

Задача 38514. Drink competition


Задача

Темы: Циклы

Gromozeka is about to take part in the final round of the STCoder Contest. In this challenge N the problems are numbered from 1 to N. Gromozeka knows what  i problem solution (\(1<=i<=N\)) requires Ti seconds. In addition, participants are offered M types of drinks, numbered from 1 to M. If Gromozeka drinks i (\(1 <= i <= M\)), his brain will be stimulated and time, he needs to solve the Pi problem becomes Xi seconds. This does not affect the time to complete other tasks.
The participant is allowed to drink exactly one of the drinks before the start of the competition. For each drink, Gromozeka wants to know how many seconds it will take him to solve all the problems if he drinks this drink. Suppose that the time it takes him to solve all the problems is equal to the sum of the time needed to solve the individual problems. Your task is to write a time calculation program instead of Gromozeka.



Input
The input is integers. In the first line the number N (\(1<=N<=100\)), in the second line N > numbers Ti (\(1<=T_i<=10^5\)). The third line contains the number M (\(1<=M<=100\)). Next comes M lines, each of which contains a pair of Pi,Xi (\(1<=P_i<=N\), \(1<=X_i<=10^5\) ).


Imprint
For each drink, calculate how many seconds it will take Gromozeka to solve all the problems if he drinks this drink, and print the results, one per line.
 

 

Examples
# Input Output Explanations
1 3
2 1 4
2
1 1
2 3
6
9
If Gromozeka drinks drink number 1, the time it takes him to complete each task will be 1, 1, and 4 seconds, respectively, for a total of 6 seconds.
If Gromozeka drinks drink 2, the time it takes him to complete each task will be 2, 3, and 4 seconds, respectively, for a total of 9 seconds.
2 5
7 2 3 8 5
3
4 2
17
4 13
19
25
30