import Data.Array

nsolver::Int -> Array Int Int -> Int -> IO ()
nsolver _    _  0 = return ()
nsolver dflt ts n = do
  pxc<-getLine
  let p:x:[]=map read (words pxc)::[Int]
  print (dflt+(x-(ts!p)))
  nsolver dflt ts (n-1)

main::IO()
main =do
  nc<-getLine
  let n = read nc ::Int
  tc<-getLine
  let tarr = listArray (1,n) (map read (words tc)::[Int])
  let dflt = sum (map read (words tc)::[Int])
  mc<-getLine
  let m =read mc ::Int
  nsolver dflt tarr m
