program sample
    implicit none
    character(19)::s
    integer(8) :: i,j,m,n,p,x
    integer(8),allocatable :: y(:),t(:)
  
    read(*,*) n
    allocate(t(n))
    read(*,*)t

    read(*,*)m
    do i=1,m
        read(*,*)p,x

        write(*,*)sum(t)-t(p)+x
    end do
    
    stop
end program sample
  

