let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let t = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  Scanf.scanf "%d\n" @@ fun m ->
  let arr = Array.init m @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun p x -> (p,x) in
  let sum = Array.fold_left (+) 0 t in
  Array.iter (fun (p,x) -> Printf.printf "%d\n" (sum - (t.(p-1)-x))) arr