let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let t_arr = Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in
  let m = Scanf.scanf "%d " (fun a -> a) in
  let px_lst = Array.to_list @@ Array.init m (fun _ -> Scanf.scanf "%d %d " (fun a b -> a-1,b)) in

  let orig_sum = Array.fold_left (+) 0 t_arr in
  let rec aux res = function
    | [] -> res
    | (p,x) :: tl -> aux ((orig_sum + x - t_arr.(p))::res) tl
  in
  let ans = List.rev @@ aux [] px_lst in
  List.iter (fun x -> Printf.printf "%d\n" x) ans

