program b
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: n,ans,i
    integer(int64),allocatable:: a(:)

    read*, n
    allocate(a(n))
    read*, a(:)

    if (minval(a) == 0) then
        print'(i0)', 0
        stop
    end if

    ans=1

    do i=1,n
        if (log10(dble(ans))+log10(dble(a(i))) > 1d18) then
            print'(i0)', -1
            stop
        else
            if (ans*a(i) > 1000000000000000000_8) then
                print'(i0)', -1
                stop
            end if
            ans=ans*a(i)
        end if
    end do
    print'(i0)', ans
end program b