

n=int(eval(input()))



t=eval(input())

t=t.split()



m=int(eval(input()))

px=[]

su=[]

for i in range(m):

    px.append(input().split())

    o=t[int(px[-1][0])-1]

    t[int(px[-1][0])-1]=int(px[-1][1])

    temp=0

    for i in t:

        temp=temp+int(i)

    su.append(temp)

    t[int(px[-1][0])-1]=o

    

for i in su:

    print(i)

        

def sumArray(n):

    sum = 0

    for i in range(len(n)):

        sum += n[i]

    return sum



n = int(eval(input()))

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

m = int(eval(input()))

sum = sumArray(t)

temp = sum

for i in range(m):

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

    sum = sum - t[data[0] - 1] + data[1]

    print(sum)

    sum = temp
n = int(eval(input()))
t = eval(input())
t = t.split()
m = int(eval(input()))
px = []
su = []
for i in range(m):
    px.append(input().split())
    o = t[int(px[-1][0]) - 1]
    t[int(px[-1][0]) - 1] = int(px[-1][1])
    temp = 0
    for i in t:
        temp = temp + int(i)
    su.append(temp)
    t[int(px[-1][0]) - 1] = o
for i in su:
    print(i)

def sumArray(n):
    sum = 0
    for i in range(len(n)):
        sum += n[i]
    return sum


n = int(eval(input()))
t = list(map(int, input().rstrip().split()))
m = int(eval(input()))
sum = sumArray(t)
temp = sum
for i in range(m):
    data = list(map(int, input().split()))
    sum = sum - t[data[0] - 1] + data[1]
    print(sum)
    sum = temp

+def sumArray(n): +    sum = 0 +    for i in range(len(n)): +        sum += n[i] +    return sum + + -t = eval(input()) -t = t.split() +t = list(map(int, input().rstrip().split())) -px = [] -su = [] +sum = sumArray(t) +temp = sum -    px.append(input().split()) -    o = t[int(px[-1][0]) - 1] -    t[int(px[-1][0]) - 1] = int(px[-1][1]) -    temp = 0 -    for i in t: -        temp = temp + int(i) -    su.append(temp) -    t[int(px[-1][0]) - 1] = o -for i in su: -    print(i) +    data = list(map(int, input().split())) +    sum = sum - t[data[0] - 1] + data[1] +    print(sum) +    sum = temp