Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = map(int, input().split())
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = map(int, input().split())
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[[p] - 1] + x)

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = map(int, input().split())
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = list(map(int, input().split()))
    print(cal - t[[p] - 1] + x)

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input().split()) for i in range(N)]
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = list(map(int, input().split()))
    print(cal - t[[p] - 1] + x)

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input().split()) for i in range(N)]
 
M = int(input())
 

a = list(map(int, input().split()))      
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input().split()) for i in range(N)]
 
M = int(input())
 

a = list(map(int, input().split()))      
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input().split()) for i in range(N)]
 
M = int(input())
 

for k in range(M):
   a = list(map(int, input().split()))      
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input().split()) for i in range(N)]
 
M = int(input())
 
a = []
for k in range(M):
    a.append(map(int, input()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input().split()) for i in range(N)]
 
M = int(input())
 
a = []
for k in range(M):
    a.append(map(int, input().split()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input()) for i in range(N)]
 
M = int(input())
 
a = []
for k in range(M):
    a.append(map(int, input().split()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input()) for i in range(N)]
 
M = int(input())
 
a = []
for i in range(M):
    a.append(map(int, input().split()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input()) for i in range(N)]
 
M = int(input())
 
a = []
for i in range(2):
    a.append(map(int, raw_input().split()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])


Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [int(input()) for i in range(N)]
 
M = int(input())
 
a = []
for i in range(M):
    a.append(map(int, raw_input().split()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])


Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [input() for i in range(N)]
 
M = int(input())
 
a = []
for i in range(M):
    a.append(map(int, raw_input().split()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])


Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
t = [input() for i in range(N)]
 
M = int(input())
 
a = []
for i in range(M):
    a.append(map(int, raw_input().split()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])
N = int(input())
 
t = [input() for i in range(N)]
 
M = int(input())
 
a = []
for i in range(M):
    a.append(map(int, raw_input().split()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])


Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)

Buggy python submission (verdict: Runtime Error):
N = int(input())

t = [input() for i in range(N)]

M = input()

a = []
for i in range(M):
    a.append(map(int, raw_input().split()))       #a=[[P1 X1]みたいな]

cal = sum(t)

for j in range(M):
    print(cal - t[a[j][0]] + a[j][1])

Fixed submission:
N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)