(* O(n + m) *)
let n = Scanf.scanf " %d" @@ (+) 0
let ts = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let m = Scanf.scanf " %d" @@ (+) 0
let pxs = Array.init m @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a - 1, b
let sum = Array.fold_left (+) 0 ts
let _ =
  let f (p, x) = Printf.printf "%d\n" @@ sum - ts.(p) + x in
  Array.iter f pxs