program ABC050B
    implicit none
    integer(8)::N,P,X,i,M,result
    integer(8),dimension(100)::T
    read(5,*)N,(T(i),i=1,N),M
    result=sum(T(1:N))

    do i=1,M
        read(5,*)P,X
        print'(i0)',result+X-T(P)
    end do
end program ABC050B