n=io.read("*n", "*l")
t={}
for i=1, n do
    t[i]=io.read("*n")
end
total=0
for i=1, n do
    total=total+t[i]
end
m=io.read("*n", "*l")
for i=1, m do
    p,x=io.read("*n","*n","*l")
    print(total-t[p]+x)
end