fun main(args: Array<String>) {
    val totalProblems = readLine()!!.toInt()
    val times = readLine()!!.split(' ').map { it.toInt() }
    val drinkNum = readLine()!!.toInt()
    var drinks = mutableMapOf<Int, Int>()
    for (i in 1..drinkNum) {
        val drinksTmp = readLine()!!.split(' ').map { it.toInt() }
        val sum = times
            .filterIndexed{index, value ->
                index != drinksTmp[0]-1 }
            .sum() + drinksTmp[1]
        println(sum)
    }
}