Problem:
 Score : 200 points    Problem Statement Joisino is about to compete in the final round of a certain programming competition.
In this contest, there are N problems, numbered 1 through N .
Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N) .  Also, there are M kinds of drinks offered to the contestants, numbered 1 through M .
If Joisino takes drink i(1≦i≦M) , her brain will be stimulated and the time it takes for her to solve problem P_i will become X_i 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.  1≦N≦100  1≦T_i≦10^5  1≦M≦100  1≦P_i≦N  1≦X_i≦10^5         Input The input is given from Standard Input in the following format:  N  T_1  T_2  ...  T_N  M  P_1  X_1  P_2  X_2  :  P_M  X_M       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.        Sample Input 1 3
2 1 4
2
1 1
2 3      Sample Output 1 6
9  If Joisino takes drink 1 , the time it takes her to solve each problem will be 1 , 1 and 4 seconds, respectively, totaling 6 seconds.  If Joisino takes drink 2 , the time it takes her to solve each problem will be 2 , 3 and 4 seconds, respectively, totaling 9 seconds.       Sample Input 2 5
7 2 3 8 5
3
4 2
1 7
4 13      Sample Output 2 19
25
30

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
p = [list(map(int, input().split())) for i in range(m)]

for i in range(m):
    time = [x for x in t]
    time[p[i][0] - 1] = p[i][1]
    print(sum(time))

Solution (Python):
N = int(input())
T = [int(i) for i in input().split()]
T_SUM = sum(T)
M = int(input())
PX = [tuple(map(int,input().split())) for _ in range(M)]
for px in PX:
  time = T_SUM + px[1] - T[px[0]-1]
  print(time)

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
t = sum(T)
M = int(input())
S = [list(map(int, input().split())) for _ in range(M)]
for s in S:
    print(t - T[s[0] - 1] + s[1])

Solution (Python):
from sys import stdin

n = int(input())
t = list(map(int, input().split()))
m = int(input())

sum_t = sum(t)

ans = []
for _ in range(m):
    p, x = map(int, stdin.readline().strip().split())
    ans.append(sum_t - t[p-1] + x)

for i in ans:
    print(i)

Solution (Python):
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

N = ri()
T = ri_()
M = ri()
wa = sum(T)
for _ in range(M):
    P, X = ri_()
    ans = wa + X - T[P - 1]
    print(ans)

Solution (Python):
n = int(input())
T = list(map(int, input().split()))
m = int(input())
P = [list(map(int, input().split())) for _ in range(m)]
for p in P:
    tmp_l = T.copy()
    tmp_l[p[0]-1] = p[1]
    print(sum(tmp_l))

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
t = sum(T)
M = int(input())
S = [list(map(int, input().split())) for _ in range(M)]
for s in S:
    print(t - T[s[0] - 1] + s[1])

Solution (Python):
n=int(input())
lst=[]

tup = tuple(map(int,input().split()))




m=int(input())

for i in range(m):
    prev,nxt=input().split()
    prev=int(prev)
    nxt=int(nxt)
    lst=list(tup)
    res = 0
    lst[prev-1]=nxt
    for i in range(n):
        res=res+lst[i]
    print(res)

Solution (Python):
n = int(input())
lt = [int(w) for w in input().split()]
m = int(input())

sum_lt = sum(lt)
for i in range(m):
    p, x = [int(w) for w in input().split()]
    print(sum_lt + x - lt[p - 1])

Solution (Python):
N = int(input())
Ts = list(map(int,input().split()))
M = int(input())
Ps =[list(map(int,input().split())) for i in range(M)]
s = sum(Ts)
for i in range(M):
  index = Ps[i][0]-1
  diff = Ps[i][1] - Ts[index]
  print(s+diff)

Solution (Python):
N=int(input())
T=list(map(int,input().split()))
M=int(input())
ans=sum(T)
for _ in range(M):
  P,X=map(int,input().split())
  print(ans-T[P-1]+X)

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())
t=list(map(int,input().split()))
sumt = sum(t)
for i in range(int(input())):
    p,x = list(map(int,input().split()))
    print(sumt+x -t[p-1])

Solution (Python):

(n, ), t, (m, ), *d = [[*map(int, i.split())] for i in open(0)]
s = sum(t)
for p, x in d:
    print(s - t[p - 1] + x)

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())
T = list(map(int, input().split()))
M = int(input())
for i in range(M):
    P, X = map(int, input().split())
    TT = T.copy()
    TT[P-1] = X
    print(sum(TT))

Solution (Python):
N = int(input())
t = list(map(int, input().split()))
M = int(input())
ans = sum(t)
for i in range(M):
    a, b = map(int, input().split())
    print(ans-t[a-1]+b)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
px = list(tuple(map(int,input().split())) for _ in range(m))

for p, x in px:
    ts = t.copy()
    ts[p-1] = x
    print(sum(ts))

Solution (Python):
from copy import copy
n = int(input())
t = list(map(int, input().split()))
m = int(input())

for i in range(m):
    p, x = map(int, input().split())
    c = copy(t)
    c[p-1] = x
    print(sum(c))

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
for _ in range(m):
	p,x = map(int,input().split())
	temp = t[p-1]
	t[p-1] = x
	print(sum(t))
	t[p-1] = temp

Solution (Python):
n = int(input())
t = list(map(int,input().split()))
m = int(input())
p = []
x = []
for i in range(m):
    a,b = map(int,input().split())
    p.append(a)
    x.append(b)

for i in range(m):
    s = list(t)
    j = p[i] - 1
    s[j] = x[i]
    print(sum(s))

Solution (Python):

n = int(input())
t = list(map(int, input().split()))
m = int(input())
p, x = zip(*[map(int, input().split()) for _ in range(m)])

sum_dflt = sum(t)
for i in range(m):
    print(sum_dflt - t[p[i] - 1] + x[i])

Solution (Python):
N = int(input())
T = list(map(int,input().split()))
M = int(input())
D = [list(map(int,input().split())) for _ in range(M)]



for i in range(M):
    temp = T.copy()
    temp[D[i][0]-1] = D[i][1]
    print(sum(temp))

Solution (Python):
import sys
sys.setrecursionlimit(500000)

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    N = ii()
    T = list(mi())
    M = ii()
    P, X = i2(M)

    S = sum(T)
    for i in range(M):
        print(S-T[P[i]-1]+X[i])


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	n = I()
	t_list = LI()
	m = I()
	px_list = LIR(m)

	original_time = sum(t_list)
	for p, x in px_list:
		print(original_time - t_list[p-1] + x, end='\r\n')


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
t = list(map(int,input().split()))
t_tm = t
m = int(input())

for i in range(m):
    p,x = map(int,input().split())
    tmp = t[p-1]
    t[p-1] = x
    print(sum(t))
    t[p-1] = tmp

Solution (Python):
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n = I()
    t = Intl()
    m = I()
    px = [Intl() for i in range(m)]
    s = sum(t)
    ps = s
    for i in range(m):
        a,b = px[i][0],px[i][1]
        s -= t[a-1]
        s += b
        print(s)
        s -= b
        s += t[a-1]

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
t = intl()
m = i()
p = []
x = []
for i in range(m):
	P,X = i2()
	p.append(P)
	x.append(X)

a = sum(t)
b = a
for i in range(m):
	a -= t[ p[i]-1 ] 
	a += x[i]
	print(a)
	a = b

Solution (Python):
n = int(input())
T = list(map(int, input().split()))
m = int(input())
s = sum(T)

for i in range(m):
    p, x = map(int, input().split())
    print(s - (T[p-1] - x))

Solution (Python):
n = int(input())
T = list(map(int, input().split()))
m = int(input())

for i in range(m):
    t = T.copy()
    p, x = map(int, input().split())
    t[p-1] = x
    print(sum(t))

Solution (Python):
N=int(input())
T=list(map(int,input().split()))
M=int(input())

U=sum(T)
for _ in range(M):
    P,X=map(int,input().split())
    print(U-T[P-1]+X)

Solution (Python):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
tmp=0
for i in range(m):
    p,x=map(int,input().split())
    tmp=t[p-1]
    t[p-1]=x
    print(sum(t))
    t[p-1]=tmp

Solution (Python):
n = int(input())
t_li = list(map(int,input().split()))
m = int(input())
d_li=[list(map(int,input().split())) for i in range(m)]

time = sum(t_li)

for i, j in d_li:
    print(time - t_li[i-1] + j)

Solution (Python):
n=int(input())
t=list(map(int, input().split()))
m=int(input())
for i in range(m):
  p,x=map(int, input().split())
  time=0
  for j in range(n):
    if j==p-1:
      time+=x
    else:
      time+=t[j]
  print(time)

Solution (Python):
N = int(input())
T = list(map(int,input().rstrip().split(" ")))
time = 0
for i in T:
    time += i
M = int(input())
for _ in range(M):
    P,X = map(int,input().rstrip().split(" "))
    print(X - T[P - 1] + time)

Solution (Python):
N = int(input())
T = list(map(int,input().split()))
M = int(input())
S = sum(T)

for m in range(M):
  P,X = map(int,input().split())
  print(S-(T[P-1]-X))

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P, X = [], []
for _ in range(M):
    p, x = map(int, input().split())
    P.append(p)
    X.append(x)

t_sum = sum(T)

for i in range(M):
    print(t_sum - T[P[i]-1] + X[i])

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())

for _ in range(M):
    p, x = map(int, input().split())
    total = 0
    for i in range(N):
        if i == p - 1:
            total += x
        else:
            total += T[i]
    print(total)

Solution (Python):


n = int(input())
t_l = list(map(int, input().split()))
m = int(input())
result = []

for i in range(m):
    t_l_i = list(t_l)
    p, x = map(int, input().split())
    t_l_i[p - 1] = x
    result.append(sum(t_l_i))

print(*result, sep='\n')

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P = []
X = []
for i in range(M):
    p, x = map(int, input().split())
    P.append(p)
    X.append(x)

for i in range(M):
    time = sum(T) - T[P[i] - 1] + X[i]
    print(time)

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())
PX = [list(map(int, input().split())) for _ in range(M)]

S  = sum(T)
for p, x in PX:
    print(S - T[p - 1] + x)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
for i in range(m):
  p, x = map(int, input().split())
  res = t[p-1] -x
  print(sum(t) - res)

Solution (Python):


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    T = read_ints()
    M = read_int()
    S = sum(T)
    for _ in range(M):
        p, x = read_ints()
        print(S-T[p-1]+x)


if __name__ == '__main__':
    solve()

Solution (Python):
N = int(input())
T = list(map(int,input().split()))
M = int(input())
A = sum(T)

for m in range(M):
  P,X = map(int,input().split())
  print(A-T[P-1]+X)

Solution (Python):
n=int(input())
t=[0]+[int(x) for x in input().split()]
m=int(input())
for _ in range(m):
    x,y=map(int,input().split())
    tt=t[:]
    tt[x]=y
    print(sum(tt))

Solution (Python):
_ = int(input())
T = list(map(int,input().split()))
M = int(input())
ans=sum(T)
for _ in range(M):
    p,x = map(int,input().split())
    print(ans - T[p-1] + x)

Solution (Python):


import math; from collections import *
import sys; from functools import reduce

def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())
def getlistofstring(): return list(input().strip().split())
def printxsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9)+7; SEXYMOD = 998244353; MAXN = int(1e5)





n = int(input())
li = get_list()
s = sum(li)
for _ in range(int(input())):
    ind, val = get_ints()
    print(s - li[ind-1] + val)

'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Solution (Python):
N = int(input())
t = list(map(int, input().split()))
T = sum(t)
M = int(input())
for _ in range(M):
  p, x = map(int, input().split())
  print(T-(t[p-1]-x))

Solution (Python):
N=int(input());T=list(map(int,input().split()));M=int(input());total=sum(T)
px=[list(map(int,input().split())) for _ in range(M)]
[print(total + px[i][1] - T[px[i][0]-1]) for i in range(M)]

Solution (Python):
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = INT()
T = LI()
M = INT()

ans = sum(T)

for i in range(M):
    tmp = ans
    P, X = MI()
    tmp = tmp - T[P - 1] + X
    print(tmp)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
Sum=sum(t)
for i in range(m):
    p, x = map(int, input().split())
    ans = Sum
    ans-=t[p-1]
    print(ans+x)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())

for _ in range(m):
  ans = sum(t)
  p,x = map(int, input().split())
  ans -= t[p-1]
  ans += x
  print(ans)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
s = [list(map(int, input().split())) for i in range(m)]

sum = sum(t)

for i in range(m):
  print(sum - t[s[i][0]-1] + s[i][1])

Solution (Python):
n=int(input())
ti=list(map(int,input().split()))
m=int(input())
p=[]
x=[]
for i in range(m):
  pn,xn=map(int,input().split())
  p.append(pn)
  x.append(xn)
tsum=sum(ti)
for i in range(m):
  sa=ti[p[i]-1]-x[i]
  print(tsum-sa)

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())
T_copy = T.copy()

for _ in range(M):
    T = T_copy.copy()
    P, X = map(int, input().split())
    T[P-1] = X
    print(sum(T))

Solution (Python):
question_num = int(input())
Time = list(map(int, input().split()))
drink_num = int(input())
spent_time = sum(Time)
drink =[]
for _ in range(drink_num):
    p, x = map(int, input().split())
    print(spent_time - (Time[p - 1] - x))

Solution (Python):
question_num = int(input())
Time = list(map(int, input().split()))
drink_num = int(input())
spent_time = sum(Time)
drink =[]
for _ in range(drink_num):
    p, x = map(int, input().split())
    drink.append([p, x])
for p, x in drink:
    print(spent_time - (Time[p - 1] - x))

Solution (Python):
import copy

N=int(input())
T=list(map(int,input().split()))
M=int(input())
for i in range(M):
  check=copy.deepcopy(T)
  P,X=map(int,input().split())
  check[P-1]=X
  print(sum(check))

Solution (Python):
n = int(input())
t = list(map(int,input().split()))
m = int(input())
for _ in range(m):
    p,x = map(int,input().split())
    print(sum(t[:p-1]) + x + sum(t[p:]))

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())

S = sum(T)
for _ in range(M):
    p, x = map(int, input().split())
    p -= 1
    print(S - T[p] + x)

Solution (Python):
def resolve():
    N = int(input())
    T = list(map(int, input().split()))
    M = int(input())
    ans = 0
    diff = []
    for i in range(M):
        P, X = list(map(int, input().split()))
        print(sum(T) - T[P-1] + X)

    return

resolve()

Solution (Python):
N=int(input())
T=list(map(int,input().split()))
M=int(input())
dr=[list(map(int,input().split()))for i in range(M)]
for i in range(M):
    print(sum(T)-T[dr[i][0]-1]+dr[i][1])

Solution (Python):






N = int(input())
T = list(map(int, input().split()))
M = int(input())
for _ in range(M):
    p,x = map(int, input().split())
    ans = sum(T) - T[p-1] + x
    print(ans)

Solution (Python):


def main():
    N = int(input())
    T = list(map(int,input().split()))
    M = int(input())
    t = sum(T)
    for _ in range(M):
        p,x = map(int,input().split())
        s = t - T[p-1] + x
        print(s)


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
T=list(map(int,input().split()))
M=int(input())
total=0
for i in range(N):
    total+=T[i]
for i in range(M):
    K=total
    P,X=map(int,input().split())
    K=K-T[P-1]
    K+=X
    print(K)

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())
SUM = sum(T)
for _ in range(M):
    P, X = map(int, input().split())
    print(SUM - T[P-1] + X)

Solution (Python):
N = int(input())
list_n = list(map(int, input().split()))
M = int(input())
list_m = [[int(i) for i in input().split()] for j in range(M)]

for i in range(M):
    x, y = list_m[i][0], list_m[i][1]
    a = list_n[x-1]
    sum_a = sum(list_n)
    print(sum_a - (a-y))

Solution (Python):
n = int(input())
T = list(map(int,input().split()))
s = sum(T)
m = int(input())
for _ in range(m):
    p,x = map(int,input().split())
    print(s-(T[p-1]-x))

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())
drag = [list(map(int, input().split())) for n in range(M)]
for d in drag:
    print(sum(T) - T[d[0] - 1] + d[1])

Solution (Python):
import copy
N = int(input())
T = list(map(int,input().split()))
M = int(input())

res = []
for _ in range(M):
    tmp = copy.copy(T)
    P,X = map(int,input().split())
    tmp[P-1] = X
    res.append(sum(tmp))
for i in res:
    print(i)

Solution (Python):
import math
from collections import deque
from collections import defaultdict

import itertools as it


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	
	ans = data[:]
	return ans

n = readInt()
t = readInts()
m = readInt()
px = []
for i in range(m):
	px.append(readInts())
sumTime = sum(t)

for i in range(m):
	print(sumTime-t[px[i][0]-1]+px[i][1])

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())

zenbu = sum(T)

for _ in range(M):
    P, X = map(int, input().split())
    print(zenbu - T[P-1] + X)

Solution (Python):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
    p,x=map(int,input().split())
    ans=sum(t)-t[p-1]+x
    print(ans)

Solution (Python):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
sumt=sum(t)

for i in range(m):
    p,q=map(int,input().split())
    print(sumt-t[p-1]+q)

Solution (Python):
n = int(input())
times = list(map(int, input().split()))
total = sum(times)
m = int(input())
for _ in range(m):
    index, newTime = map(int, input().split())
    print(total - times[index - 1] + newTime)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
p = [list(map(int, input().split())) for _ in range(m)]
a = sum(t)
for i,j in p:
    print(a-t[i-1]+j)

Solution (Python):
n = int(input())
t = list(map(int,input().split()))
m = int(input())
for i in range(m):
    p,x = map(int,input().split())
    print(sum(t) + (x-t[p-1]))

Solution (Python):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
time=sum(t)
for i in range(m):
  p,x=map(int,input().split())
  print(time-t[p-1]+x)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
px = [list(map(int, input().split())) for _ in range(m)]

for i in range(m):
    ans = [0]*n
    for j in range(n):
        ans[j] = t[j]
    p = px[i][0] - 1
    ans[p] = px[i][1]
    print(sum(ans))

Solution (Python):
N = int(input())
T = list(map(int,input().split()))
num = sum(T)
M = int(input())
for i in range(M):
    p,x = map(int,input().split())
    print(num-(T[p-1]-x))

Solution (Python):
def abc050_b():
    _ = int(input())
    T = list(map(int, input().split()))
    M = int(input())
    Query = [tuple(map(int, input().split())) for _ in range(M)]

    tot = sum(T)
    for p, x in Query:
        ans = tot - T[p-1] + x
        print(ans)

abc050_b()

Solution (Python):
n=int(input())
s=list(map(int,input().split()))
k=int(input())
l=[]
for i in range(k):
    p,x=map(int,input().split())
    l.append(sum(s)-s[p-1]+x)
    
for i in range(k):
    print(l[i])

Solution (Python):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
    p,x=map(int,input().split())
    ans=sum(t)-t[p-1]+x
    print(ans)

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())
PX = [list(map(int, input().split())) for i in range(M)]

for i in range(M):
    test = []
    for j in range(N):
        test.append(T[j])
    test[PX[i][0]-1] = PX[i][1]
    print(sum(test))

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
for _ in range(m):
    p, x = map(int, input().split())
    ans = sum(t) - t[p-1] + x
    print(ans)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
sum = sum(t)
m = int(input())
px = [list(map(int, input().split())) for i in range(m)]
for j in range(m):
    p, x = px[j]
    print(sum - t[p-1] + x)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
m=int(input())
b=[list(map(int,input().split())) for _ in range(m)]
for i in b:
    print(sum(a)-a[i[0]-1]+i[1])

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
m=int(input())
for i in range(m):
    s,t=map(int,input().split())
    print(sum(a)-a[s-1]+t)

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
total = sum(t)
for _ in range(m):
    p, x = map(int, input().split())
    ans = total - t[p-1] + x
    print(ans)

Solution (Python):
def solve() : 
  time = list()
  
  N = int(input())
  
  time = list(map(int, input().split()))
  
  M = int(input())
  
  for i in range(M) : 
    p, x = tuple(map(int, input().split()))
    
    ans = time.copy()
    ans[p - 1] = x
    sum = 0
    for j in range(len(ans)) :
      sum += ans[j]
    print(sum)
    
solve()

Solution (Python):
n = int(input())
tl = [0]+list(map(int, input().split()))
s = sum(tl)
m = int(input())
for _ in range(m):
    p, tx = map(int,input().split())
    print(s-tl[p]+tx)

Solution (Python):
n = int(input())
t = list(map(int,input().split()))
m = int(input())
p = [list(map(int,input().split())) for i in range(m)]
k = 0
tmp = t[:]
for i in range(m):
    k = p[i][0]
    t[k-1] = p[i][1]
    print(sum(t))
    t[k-1] = tmp[k-1]

Solution (Python):
N = int(input())
T = [int(t) for t in input().split()]
M = int(input())
PX = [tuple(map(int, input().split())) for _ in range(M)]

total_time = sum(T)
for i in range(M):
    p, x = PX[i]
    print(total_time - T[p - 1] + x)

Solution (Python):
n = int(input())
T = list(map(int, input().split()))
m = int(input())

t = sum(T)

for i in range(m):
  p,x = map(int, input().split())
  print(t - (T[p-1]-x))

Solution (Python):
import copy
n = int(input())
t = list(map(int, input().split()))
m = int(input())
d = []
ans = []
for i in range(m):
    d.append(list(map(int, input().split())))
for i in range(m):
    s = copy.copy(t)
    s[d[i][0] - 1] = d[i][1]
    ans.append(sum(s))
for i in ans:
    print(i)

Solution (Python):
n = int(input())
t = list(map(int,input().split()))
m = int(input())

for i in range(m):
    p,x = list(map(int,input().split()))
    a = t.copy()
    a[p-1] = x
    print(sum(a))

Solution (Python):
n = int(input())
t = list(map(int, input().split()));
m = int(input())
p, x = [0] * m, [0] * m
for i in range(m) :
  p[i], x[i] = map(int, input().split())

for i in range(m) :
  res = 0
  for j in range(n) :
    if j+1 == p[i] : 
      res += x[i]
    else :
      res += t[j]
  print(res)

Solution (Python):
N = int(input())
T = list(map(int,input().split()))
M = int(input())

total = sum(T)

for i in range(M):
    p,x = map(int,input().split())
    print(total-T[p-1]+x)

Solution (Python):
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") 

n = int(input())
t = list(map(int,input().split()))
sum_num = sum(t)
for _ in range(int(input())):
    p,x = map(int,input().split())
    print(sum_num - t[p-1] + x)

Solution (Python):
N=int(input())
T=list(map(int,input().split()))
base=sum(T)
M=int(input())
for _ in range(M):
  p, x=map(int, input().split())
  print(base+x-T[p-1])

Solution (Python):
N = int(input())
T = list(map(int, input().split()))
M = int(input())
D = [tuple(map(int, input().split())) for _ in range(M)]

S = sum(T)

for i in range(M):
    print(S - T[D[i][0] - 1] + D[i][1])

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
t_sum = sum(t)

for i in range(m):
    p, x = map(int, input().split())
    ans = t_sum - t[p-1] + x
    print(ans)

Solution (Python):
n = int(input())
t = list(map(int,input().split()))
m = int(input())
tum = sum(t)
for i in range(m):
    p,x = map(int,input().split())
    print(tum-t[p-1]+x)

Solution (Python):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
temp=sum(t)
for i in range(m):
  p,x=map(int,input().split())
  print(temp-t[p-1]+x)

Solution (Python):
n=int(input())
t=list(map(int,input().split()))
sum=0
for i in range(n):
  sum+=t[i]

m=int(input())
for i in range(m):
  p,x=map(int,input().split())
  sumi=sum-t[p-1]+x
  print(sumi)

Solution (Python):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
ans=[0]*m
for i in range(m):
    p,x=map(int,input().split())
    ans[i]=sum(t)-t[p-1]+x
for i in range(m):
    print(ans[i])

Solution (Python):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
px = {}
for i in range(m):
  p, x = map(int, input().split())
  px[i] = [p, x]
time = [sum(t)] * m
for i in range(len(px)):
  time[i] = time[i] - t[px[i][0] - 1] + px[i][1]
for e in time:
  print(e)

Solution (Python):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
t_tot=sum(t)
p=x=0
a=0

for _ in range(m):
	p,x=map(int,input().split())
	a=t_tot-t[p-1]+x
	print(a)

Solution (Python):
N = int(input())
T = [0] + list(map(int, input().split()))
M = int(input())
P = [0]
X = [0]
for _ in range(M):
    p, x = list(map(int, input().split()))
    P += [p]
    X += [x]
    
for i in range(1, M + 1):
    print(sum(T[1:]) - (T[P[i]] - X[i]))

Solution (Python):
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

n = I()
t = Intl()
m = I()
px = [Intl() for i in range(m)]

s = sum(t)
time = s
for i in range(m):
    print(time-t[px[i][0]-1]+px[i][1])
    time = s

Solution (Python):
n = int(input())
init_time = list(map(int, input().split()))
m = int(input())

drink = list()

for a in range(m):
    drink.append(list(map(int, input().split())))

x = 0

for a in range(m):
    for b in range(n):
        if drink[a][0] == b+1:
            x += drink[a][1]
        else:
            x += init_time[b]
    print(x)
    x = 0