program prob2
    implicit none
    integer(8)::N,i,j,M,ans,P,X
    integer(8),allocatable::T(:)
    read(*,*) N
    allocate(T(N))
    read(*,*) T
    ans = sum(T)
    read(*,*) M
    do i = 1,M
        read(*,*) P,X
        write(*,*) ans - T(P) + X
    end do
    stop
end program