fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val t = readLine()!!.split(" ").map { it.toInt() }
    val m = readLine()!!.toInt()
    val total = t.sum()
    val drink = (1..m).map { readLine()!!.split(" ").map { it.toInt() } }
    drink.forEach {
        println(total - (t[it[0]-1] - it[1]))
    }
}