PROGRAM ATCODER

implicit none
integer :: n,m,p,x,i,sum,j
integer,allocatable :: t(:)

read*, n
allocate(t(n))
read*, (t(i), i=1,n)
read*, m

do i = 1, m
  sum = 0
  read*, p,x
  do j = 1, n
    if ( p == j ) then
      sum = sum + x
    else
      sum = sum + t(j)
    end if
  end do
  print'(i0)', sum
end do

contains
!!!!!! サブルーチンは↓
!!!!!!

END PROGRAM ATCODER