program prob2
    implicit none
    integer(8)::N, i
    integer(16):: ans
    integer(8), allocatable::A(:)
    read(*,*) N
    allocate(A(N))
    ans = 1

    read(*,*) A
    do i = 1,N
        if(A(i) == 0)then
            write(*,*) 0
            stop
        end if
    end do

    do i = 1, N
        ans = ans*A(i)
        if(ans > 10_8**18)then
            write(*,*) -1
            stop
        end if
    end do
    write(*,*) ans

    deallocate(A)
    stop
end program prob2