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