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-----
3
2 1 4
2
1 1
2 3

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

Solutions:
N = int(input())
T = [int(TN) for TN in input().split()]
SumT = sum(T)
M = int(input())
PX = [[] for TM in range(0,M)]
for TM in range(0,M):
    PX[TM] = [int(TPX) for TPX in input().split()]
for TM in range(0,M):
    print(SumT-T[PX[TM][0]-1]+PX[TM][1])

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

N=int(input())
T=list(map(int,input().split()))
M=int(input())
P=[list(map(int, input().split())) for i in range(M)]
tmp=0
ans=0

for i in range(M):
    tmp=0
    for j in range(len(T)):
        if j == P[i][0]-1:
            tmp +=P[i][1]
        else:
            tmp +=T[j]
    print(tmp)

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


n = int(input())
a = list(map(int, input().split()))
num_drink = int(input())

for i in range(num_drink):
    P,X = map(int,input().split())
    A = a.copy()
    A[P-1] = X
    print(sum(A))

N = int(input())
T = list(map(int,input().split()))
M = int(input())
for i in range(M):
    Pi,Xi=map(int,input().split())
    a = T[Pi-1]
    T[Pi-1] = Xi
    b = 0
    for j in range(N):
        b = b + T[j]
    print(b)
    T[Pi-1] = a

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

n=int(input())
l=[0]+list(map(int,input().split()))
ans=sum(l)
for i in range(int(input())):
  a,s=list(map(int,input().split()))
  print((ans-l[a]+s))


n = int(input())
data_1 = list(map(int,input().split()))
m = int(input())
data_2 = [input().split() for i in range(m)]


for i in range(m):
    sum = 0
    b = int(data_2[i][0]) - 1
    a = data_1[b]
    data_1[b] = int(data_2[i][1])
    for j in range(n):
        sum += data_1[j]
    print(sum)
    data_1[b] = a

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

sum_T = sum(T)

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



num_problems = int(input())
t = [int(n) for n in input().split()]
total = sum(t)
num_drinks = int(input())

for i in range(num_drinks):
  m_id, m_val = [int(n) for n in input().split()]
  ans = total - t[m_id-1] + m_val
  print(ans)


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

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

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

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


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)

N = int(input())
times = list(map(int, input().split()))

M = int(input())
drinks = [tuple(map(int, input().split()))
          for _ in range(M)]

time_sum_raw = sum(times)
for pi, xi in drinks:
    print((time_sum_raw - times[pi - 1] + xi))


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

n = int(input())
times = list(map(int, input().split()))
m = int(input())
drinks = []
for _ in range(m):
    drink = list(map(int, input().split()))
    drinks.append(drink)

for drink in drinks:
    time = 0
    copy = times.copy()
    copy[drink[0]-1] = drink[1]
    for i in copy:
        time += i
    print(time)

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)-t[p-1]+x)

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):
    p, x = px[i][0], px[i][1]
    p -= 1
    cnt = 0
    for j in range(n):
        if p == j:
            cnt += x
        else :
            cnt += t[j]
    print(cnt)


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

temp = sum(t)

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

import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: list(map(int, sys.stdin.readline().split()))
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
t = rl()
sum_ = sum(t)
m = ri()
for _ in range(m):
    p, x = rm()
    p -= 1
    print((sum_ - t[p] + x))













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


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

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



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

N=int(input())
T=input()
M=int(input())
P=[input() for i in range(M)]

def ans050(N:int, T:str, M:int, P:list):
    T_list=list(map(int,T.split()))
    ans_list=[]
    for i in range(M):
        T_list = list(map(int, T.split()))
        P_list=list(map(int,P[i].split()))
        del T_list[P_list[0]-1]
        T_list.append(P_list[1])
        ans_list .append(sum(T_list))
    return ans_list
for i in range(M):
    print((ans050(N,T,M,P))[i])

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

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


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

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


import sys,bisect

from sys  import stdin,stdout

from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right

from math import gcd,ceil,floor,sqrt

from collections import Counter,defaultdict,deque,OrderedDict

from queue import Queue,PriorityQueue

from string import ascii_lowercase


sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 998244353
mod = 10**9+7

def isPrime(n):
    if (n <= 1) :return False
    if (n <= 3) :return True
    if (n%2 == 0 or n%3 == 0):return False
    for i in range(5,ceil(sqrt(n))+1,6):
        if (n%i==0 or n%(i+2)==0):
            return False
    return True

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return list(map(int,stdin.readline().split()))

def pr(n):
    stdout.write(str(n)+"\n")
    
def DFS(dictionary,vertex,visited):
    visited[vertex]=True
    stack=[vertex]
    print(vertex)
    while stack:
        a=stack.pop()
        for i in dictionary[a]:
            if not visited[i]:
                print(i)
                visited[i]=True
                stack.append(i)


def BFS(dictionary, vertex,visited):
    visited[vertex]=True
    q=deque()
    q.append(vertex)
    while q:
        a=q.popleft()
        for i in dictionary[a]:
            if not visited[i]:
                visited[i]=True
                q.append(i)
                print(i)

                


def soe(limit):
    l=[1]*(limit+1)
    l[0]=0
    l[1]=0
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0
    
    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
            
    
def solve():
    n=inp()
    l=li()
    s=sum(l)
    d={i+1:l[i] for i in range(n)}
    m=inp()
    for i in range(m):
        x=s
        a,b=mp()
        x-=d[a]
        x+=b
        pr(x)


for _ in range(1):
    solve()
    


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

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


input();t=list(map(int,input().split()));T=sum(t)
print(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\n')

n = int(input())
tl = list(map(int, input().split()))
time = sum(tl)
m = int(input())

for _ in range(m):
    p, x = list(map(int, input().split()))
    print((time - (tl[p-1]-x)))


#!/usr/bin/env python3
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for _ in range(m):
    p,x=map(int,input().split())
    t_true=t[p-1]
    t[p-1]=x
    print(sum(t))
    t[p-1]=t_true

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

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

sum_l=sum(l)

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


n = int(input())
t_lst = list(map(int, input().split()))
m = int(input())
px_lst = [list(map(int, input().split())) for _ in range(m)]

time_lst = []
for i in range(m):
    problem = px_lst[i][0] - 1
    time = px_lst[i][1]
    before = t_lst[problem]
    t_lst[problem] = time
    time_lst.append(sum(t_lst))
    t_lst[problem] = before

for i in range(m):
    print(time_lst[i])

import copy

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

def __starting_point():
    main()

__starting_point()

import copy
n = int(input())
li = list(map(int,input().split()))
lis = copy.copy(li)
m = int(input())
dri = [list(map(int,input().split())) for i in range(m)]
for i in range(len(dri)):
    lis = copy.copy(li)
    lis[dri[i][0]-1] = dri[i][1]
    print(sum(lis))

a=int(input())
b=list(map(int,input().split()))
c=int(input())
d=[input().split() for i in range(c)]
for i in range(c):
  print(sum(b)-b[int(d[i][0])-1]+int(d[i][1]))

#!/usr/bin/env python3
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P = [0] * M
X = [0] * M
for i in range(M):
    P[i], X[i] = list(map(int, input().split()))

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


N = int(input())
T = list(map(int,input().split()))

t_sum = sum(T)

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

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

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

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

i = 0
for x[i] in x:
    l = list(t)
    j = x[i][0] - 1 #インデックス
    k = x[i][1]     #置換元
    i += i
    l[j] = k
    print(sum(l))

n = int(input())
t = [int(i) for i in input().split()] #分割した文字列を順繰りにintに変換してリストに追加
m = int(input())

for i in range(m):
    sum = 0
    count = 1
    p, x = list(map(int, input().split()))
    for j in t:
        if(p == count):
            sum += x
        else:
            sum += j
        count += 1
    print(sum)


n = int(input())
t = [int(s) for s in input().split()]
m = int(input())
total = sum(t)
ans = []
for i in range(m):
    p, x = map(int, input().split())
    ans.append(total - t[p - 1] + x)

for a in ans:
    print(a)

a=int(input())
b=list(map(int,input().split()))
c=int(input())
d=[]
for i in range(c):
  d.append(list(map(int,input().split())))

for i in range(c):
  f=b.copy()
  p=d[i][0]-1
  f[p]=d[i][1]
  print((sum(f)))


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


import copy
n = int(input())
T = list(map(int,input().split()))
m = int(input())

for _ in range(m):
  A = copy.copy(T)
  a,b = map(int,input().split())
  A[a-1] = b
  print(sum(A))

# N問の問題が用意されている
N = int(input())
# 問題を解くのにかかる時間
T = list(map(int, input().split()))

# ドリンクの種類M
M = int(input())
# ドリンクを飲んだ場合の時間をリストに格納する
X = []

# まずはドリンクを飲んだ場合の時間をXに格納する
for i in range(M):
    X.append(list(map(int,input().split())))
    X[i][0] = X[i][0]-1

Y = []
# それぞれの問題の解く時間を取得する
for i in range(N):
    Y.append(T[i])
    
for i in range(len(X)):
    Y_copy = Y.copy()
    Y_copy[X[i][0]] = X[i][1]
    print(sum(Y_copy))

n = int(input())
p = list(map(int, input().split()))
k = int(input())
for i in range(k):
  a, b = list(map(int, input().split()))
  c = p[a-1]
  p[a-1] = b
  print((sum(p)))
  p[a-1] = c


quiznum=int(input())
timeline=input().split(" ")
timeline=[int(n) for n in timeline]
#print(timeline)
time_0=0
for i in range(quiznum):
    time_0+=timeline[i]
#print(time_0)

medinum=int(input())
for i in range(medinum):
    temp_line=input().split(" ")
    a=int(temp_line[0])
    b=int(temp_line[1])
    time=time_0 - timeline[a-1] + b
    print(time)

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

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)-(t[p-1]-x))

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

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


#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import copy

def main():
    questions=[]
    dp=[]
    n = int(input())
    questions=list(map(int,input().split()))
    m = int(input())
    drinks=[list(map(int,input().split())) for _ in range(m)]
    for drink in drinks:
        dp=copy.deepcopy(questions)
        dp[drink[0]-1]=drink[1]
        print(sum(dp))
    
def __starting_point():
    main()
__starting_point()

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


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):
    t_sum = X[i]
    for j in range(N):
        if j == P[i] - 1:
            continue
        t_sum += T[j]
    print(t_sum)

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


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

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

input();t=[*map(int,input().split())];T=sum(t)
print(*[T-t[i-1]+j for i,j in [[*map(int,input().split())] for _ in range(int(input()))]],sep='\n')

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


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

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

N=int(input())
T=list(map(int,input().split()))
M=int(input())
drink=[]
for i in range(M):
    P,X=map(int,input().split())
    drink.append([P,X])
    
for j in range(len(drink)):
    P,X=drink[j]
    time=X+sum(T)-T[P-1]
    print(time)

import copy

n = int(input())
t = [int(x) for x in input().split()]
m = int(input())
p = []
for i in range(m):
  p.append([int(x) for x in input().split()])

for i in range(m):
  r = copy.copy(t)
  r[p[i][0]-1] = p[i][1]
  print(sum(r))

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

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


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

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) - t[p-1] + x)

N=int(input())#問題の数
T=list(map(int,input().split()))#問題を解くのにかかる時間
M=int(input())#ドリンクの種類の数
for i in range(1,M+1):
    tmp=list(map(int,input().split()))
    tmp2=T[tmp[0]-1]
    T[tmp[0]-1]=tmp[1]
    print(sum(T))
    T[tmp[0]-1]=tmp2

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

N = int(input())
T = input().split()
M = int(input())

for i in range(N):
   T[i] = int(T[i])

S = sum(T)

for i in range(M):
   l = input().split()
   print(S - (T[int(l[0]) - 1] - int(l[1])))

N = int(input())
T = list(map(int, input().split()))
M = int(input())
L = []
res = []
for i in range(M):
    P, X = list(map(int, input().split()))
    buf = []
    for j in range(len(T)):
        if P == j+1:
            buf.append(X)
        else:
            buf.append(T[j])
    res.append(sum(buf))

for i in res:
    print(i)


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

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

n,t=int(input()),list(map(int,input().split()));T=sum(t)
print(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\n')

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

N = int(input())
*T, = map(int, input().split())
M = int(input())
px = [list(map(int, input().split())) for _ in range(M)]

for i in range(M):
    pi = px[i][0] - 1
    print(sum(T) - T[pi] + px[i][1])

N = int(input())
times = list(map(int,input().split()))
M = int(input())
drinks = []
for _ in range(M):
    drinks.append(list(map(int,input().split())))

for drink in drinks:
    total = 0
    for j in range(N):
        if drink[0] == j+1:
            total += drink[1]
        else:
            total += times[j]
    print(total)

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+x-t[p-1])

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


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

for i in range(M):
    sum_num = 0
    for j in range(N):
        if L[i][0] - 1 == j:
            sum_num += L[i][1]
        else:
            sum_num += T[j]
    print(sum_num)


N = int(input())
T = list(map(int,input().split()))
M =int(input())
px = [list(map(int,input().split())) for i in range(M)]

sumTime = sum(T)

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

n = int(input())
timeList = list(map(int, input().split()))
m = int(input())
argList = [list(map(int, input().split())) for _ in range(m)]

#普通にやると
res_time = sum(timeList)

for a in argList:

    #a[0]問目を解くのに　a[1]秒かかるよ
    print((res_time - timeList[a[0]-1] + a[1]))



n = int(input())

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

m = int(input())

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


N = int(input())
li = list(map(int, input().split()))
M = int(input())
an = sum(li)
for i in range(M):
    p,x = map(int, input().split())
    h = x - li[p-1]
    print(sum(li) + h)

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


import sys, math
from itertools import combinations as c, product as p
from collections import deque
sys.setrecursionlimit(10**9)


def si(): return input()
def ii(): return int(input())
def fi(): return float(input())
def lstr(): return input().split()
def lint(): return list(map(int, input().split()))
def lint_dec(): return list(map(lambda x:int(x) - 1, input().split()))
def lnstr(n): return [input() for _ in range(n)]
def lnint(n): return [int(input()) for _ in range(n)]
def lint_list(n): return [lint() for _ in range(n)]



############################################################
N = ii()
T = lint()
M = ii()
total = sum(T)

for _ in range(M):
    P, X = lint()
    print(total - T[P - 1] + X)

n = int(input())
t_l = list(map(int, input().split()))
m = int(input())
import copy
for _ in range(m):
    k, v = map(int, input().split())
    tmp_t = copy.deepcopy(t_l)
    tmp_t[k-1] = v
    print(sum(tmp_t))

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 px:
    print((sum(t) - t[i[0]-1] + i[1]))


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

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

    


N = int(input())

T = list(map(int, input().split()))
M = int(input())

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

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


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

from typing import List


def answer(n: int, t: List[int], m: int, pxs: List[List[int]]) -> str:
    result = []
    for px in pxs:
        t_copy = t.copy()
        t_copy[px[0] - 1] = px[1]
        result.append(str(sum(t_copy)))

    return '\n'.join(result)


def main():
    n = int(input())
    t = list(map(int, input().split()))
    m = int(input())
    pxs = [list(map(int, input().split())) for _ in range(m)]
    print((answer(n, t, m, pxs)))


def __starting_point():
    main()

__starting_point()

n = int(input())
T = list(map(int, input().split()))
m = int(input())
D = [tuple(map(int, input().split())) for _ in range(m)]

sum_T = sum(T)
for i in range(m):
    print((sum_T - T[D[i][0] - 1] + D[i][1]))