import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toInt
  val t = StdIn.readLine().split(" ").map(_.toInt)
  val m = StdIn.readLine().toInt
  val px = (0 until m).map( _ => StdIn.readLine().split(" ").map(_.toInt))
  
  val r = px.map{ pi_xi => 
    (0 until n).foldLeft(0){ (acc, ti) =>
      acc + (if(ti == (pi_xi(0)-1)) pi_xi(1) else t(ti))
    }
  }
  
  r.foreach(println)
  
}
