sumA = []
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
for i in range(Q):
    B,C = map(int,input().split())
    Areplace = [C if i == B else i for i in A]
    A = Areplace
    sumA.append(sum(A))
for i in range(Q):
    print(sumA[i])