integer :: n,m,p,x
integer,allocatable :: t(:)
integer :: i
integer :: total

read *,n
allocate(t(n))
read *,t
read *,m
total = sum(t)
do i = 1, m
   read *,p,x
   print '(i0)',total - t(p) + x
enddo
end