open Scanf
let () =
  let xs = scanf " %d" (fun n -> Array.init n (fun _ -> scanf " %d" (fun t -> t))) in
  let total = Array.fold_left (+) 0 xs in
  scanf " %d" (fun m -> Array.init m (fun _ -> scanf " %d %d" (fun p u -> p, u)))
  |> Array.iter (fun (p, u) -> Printf.printf "%d\n" (total + (u - xs.(p-1))))
