import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt
  val ts = Vector.fill(n)(sc.nextInt)
  val m = sc.nextInt
  val pxs = Vector.fill(m)((sc.nextInt, sc.nextInt))

  pxs.foreach { case (p, x) => println(ts.updated(p - 1, x).sum) }
}
