N = int(input())
A = [int(x) for x in input().split()]
Q = int(input())

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

for j in range(Q):
    print(l[j])