program main
  implicit none
  integer :: n, m, i, j, s, p, x
  integer, allocatable :: t(:)
  read (*, *) n
  allocate (t(n))
  read (*, *) t
  s = sum(t)
  read (*, *) m
  do i = 1, m
    read (*, *) p, x
    write (*, "(i0)") s - t(p) + x
  end do
end program main
