program main
  implicit none
  integer :: n
  integer(16), allocatable :: an(:)
  integer :: i
  integer(16) :: threshold, ans
  logical :: flag
  threshold = 1

  do i = 1, 18
    threshold = threshold * 10
  enddo

  read *, n
  allocate(an(n))
  read *, an(1:n)

  if (minval(an) == 0)then
    print "(i0)", 0
  else

    flag = .true.
    ans = 1
    do i = 1, n
      ans = ans * an(i)
      if (ans > threshold)then
        flag = .false.
        exit
      endif
    enddo

    if (flag)then
      print "(i0)", ans
    else
      print "(i0)", -1
    endif
  endif
end program
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEan.0 = internal unnamed_addr global ptr null
@_QFEan.8 = internal unnamed_addr global i64 0
@_QQcl.de8a5681f30feaca6442f87768f7cf49 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1279/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.de8a5681f30feaca6442f87768f7cf49, i32 14)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %7 = load i32, ptr %3, align 4, !tbaa !3
  %8 = call i32 @llvm.smax.i32(i32 %7, i32 0)
  %9 = zext i32 %8 to i64
  %10 = shl nuw nsw i64 %9, 4
  %11 = call ptr @malloc(i64 %10)
  store ptr %11, ptr @_QFEan.0, align 8, !tbaa !7
  store i64 %9, ptr @_QFEan.8, align 8, !tbaa !7
  %12 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.de8a5681f30feaca6442f87768f7cf49, i32 16)
  %.unpack = load ptr, ptr @_QFEan.0, align 8, !tbaa !7
  %13 = load i32, ptr %3, align 4, !tbaa !3
  %14 = call i32 @llvm.smax.i32(i32 %13, i32 0)
  %15 = zext i32 %14 to i64
  store ptr %.unpack, ptr %2, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 1
  store i64 16, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 4
  store i8 11, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 1
  store i64 %15, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 2
  store i64 16, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %16 = call i1 @_FortranAioInputDescriptor(ptr %12, ptr nonnull %2)
  %17 = call i32 @_FortranAioEndIoStatement(ptr %12)
  %.unpack155 = load ptr, ptr @_QFEan.0, align 8, !tbaa !7
  %.unpack162.unpack.unpack164 = load i64, ptr @_QFEan.8, align 8, !tbaa !7
  store ptr %.unpack155, ptr %1, align 8, !tbaa !7
  %.fca.1.gep81 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 16, ptr %.fca.1.gep81, align 8, !tbaa !7
  %.fca.2.gep83 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep83, align 8, !tbaa !7
  %.fca.3.gep85 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep85, align 4, !tbaa !7
  %.fca.4.gep87 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 11, ptr %.fca.4.gep87, align 1, !tbaa !7
  %.fca.5.gep89 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep89, align 2, !tbaa !7
  %.fca.6.gep91 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep91, align 1, !tbaa !7
  %.fca.7.0.0.gep93 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep93, align 8, !tbaa !7
  %.fca.7.0.1.gep95 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack162.unpack.unpack164, ptr %.fca.7.0.1.gep95, align 8, !tbaa !7
  %.fca.7.0.2.gep97 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 16, ptr %.fca.7.0.2.gep97, align 8, !tbaa !7
  %18 = call i128 @_FortranAMinvalInteger16(ptr nonnull %1, ptr nonnull @_QQcl.de8a5681f30feaca6442f87768f7cf49, i32 16, i32 0, ptr null)
  %19 = icmp eq i128 %18, 0
  br i1 %19, label %20, label %23

20:                                               ; preds = %0
  %21 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.de8a5681f30feaca6442f87768f7cf49, i32 19)
  %22 = call i1 @_FortranAioOutputInteger32(ptr %21, i32 0)
  br label %40

23:                                               ; preds = %0
  %24 = load i32, ptr %3, align 4, !tbaa !3
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %23
  %.unpack167 = load ptr, ptr @_QFEan.0, align 8, !tbaa !7
  br label %26

26:                                               ; preds = %.lr.ph, %33
  %.0128184 = phi i32 [ 1, %.lr.ph ], [ %34, %33 ]
  %.0130183 = phi i128 [ 1, %.lr.ph ], [ %31, %33 ]
  %27 = sext i32 %.0128184 to i64
  %28 = add nsw i64 %27, -1
  %29 = getelementptr i128, ptr %.unpack167, i64 %28
  %30 = load i128, ptr %29, align 8, !tbaa !3
  %31 = mul i128 %30, %.0130183
  %32 = icmp sgt i128 %31, 1000000000000000000
  br i1 %32, label %37, label %33

33:                                               ; preds = %26
  %34 = add nuw i32 %.0128184, 1
  %exitcond.not = icmp eq i32 %.0128184, %24
  br i1 %exitcond.not, label %._crit_edge, label %26

._crit_edge:                                      ; preds = %33, %23
  %.0130.lcssa = phi i128 [ 1, %23 ], [ %31, %33 ]
  %35 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.de8a5681f30feaca6442f87768f7cf49, i32 33)
  %36 = call i1 @_FortranAioOutputInteger128(ptr %35, i128 %.0130.lcssa)
  br label %40

37:                                               ; preds = %26
  %38 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.de8a5681f30feaca6442f87768f7cf49, i32 35)
  %39 = call i1 @_FortranAioOutputInteger32(ptr %38, i32 -1)
  br label %40

40:                                               ; preds = %20, %._crit_edge, %37
  %.sink = phi ptr [ %21, %20 ], [ %35, %._crit_edge ], [ %38, %37 ]
  %41 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare i128 @_FortranAMinvalInteger16(ptr, ptr, i32, i32, ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger128(ptr, i128) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #1

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
