N = int(input())
A = list(map(int, input().split()))
Q = int(input())
i = 0
j = 0
while i < Q:
    B, C = map(int, input().split())
    for j in range(len(A)):
        if B == j:
            A[j] = C
        print(sum(A))
    i += 1