local n = io.read("*n")
local t = {}
for i = 1, n do t[i] = io.read("*n") end
local sum = 0
for i = 1, n do sum = sum + t[i] end
local m = io.read("*n")
for i = 1, m do
  local a, b = io.read("*n", "*n")
  print(sum - t[a] + b)
end
