
extension String: CollectionType {
    static func getValues(separator: Character = " ") -> [String] {
        return readLine()!.split(separator)
    }
}

typealias PX = (P: Int, X: Int)

let N = Int(String.getValues()[0])
let T = String.getValues().map {Int($0)!}
let M = Int(String.getValues()[0])!

var PXs = [PX]()
(0 ..< M).forEach { i in
    let values = String.getValues()
    let P = Int(values[0])!
    let X = Int(values[1])!
    PXs.append(PX(P, X))
}

let sum = T.reduce(0) { value, current -> Int in
    value + current
}

let results = PXs.map { px -> Int in
    let diff = px.X - T[px.P - 1]
    return sum + diff
}

results.forEach { r in
    print(r)
}
