program prob2
    implicit none
    integer :: N, M
    integer, allocatable, dimension(:) :: T, P, X
    integer :: ans, i, j
    read(*,*) N
    allocate(T(N))
    read(*,*) T
    read(*,*) M
    allocate(P(M))
    allocate(X(M))
    do i = 1, M
        read(*,*) P(i), X(i)
    end do
    do i = 1, M
        ans = 0
        do j = 1, N
            if(j == P(i)) then
                ans = ans + X(i)
            else
                ans = ans + T(j)
            end if
        end do
        write(*,*) ans
    end do

    deallocate(T, P, X)


    stop
contains
end program prob2