program main
  implicit none
  
  integer :: n,t(100)=0,m,p(100)=0,x(100)=0,i,j,s=0
  
  read(*,*)n
  read(*,*)(t(i),i=1,n)
  read(*,*)m
  do i= 1, m
    read(*,*)p(i),x(i)
  end do
  
  do i = 1, n
    s = s + t(i)
  end do
  
  do i = 1, m
    write(*,*)s - t(p(i)) + x(i)
  end do
end program main