open System
open System.Collections.Generic


let R T = stdin.ReadLine()|> T
let RS T = stdin.ReadLine().Split()|>Array.map T
let Mod = (1e9|>int64)+7L
[<EntryPoint>]
let main argv =
    let N=R int
    let T=RS int
    let M=R int
    let sum=Array.sum T
    for i in [0..M-1] do
        let px=RS int
        printfn "%d" (sum-T.[px.[0]-1]+px.[1])
    0
