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