program sample
    implicit none
  
    integer(8) :: y,n,i
    integer(8),allocatable :: x(:)
  
    
  
    ! 整数を読み込む
    read(*,*)n
    allocate(x(n))
    read(*,*)x
    do i=1,n
        y=y*x(i)
        if (y>10_8**18_8) then
            write(*,*) -1
            stop
        end if
    end do
    write(*,*) x*y
    deallocate(x)
    stop
  end program sample
  