program redistribution
  implicit none
  integer(8), parameter :: modu = 1000000007
  integer :: s, i
  integer(8) :: dp(2000) = 0
  read(*,*) s
  dp(3) = 1
  do i = 4, s
    dp(i) = mod(dp(i - 1) + dp(i - 3), modu)
  end do
  write(*,'(i0)') dp(s)
end program redistribution
; 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"

@_QFEdp = internal unnamed_addr global [2000 x i64] zeroinitializer
@_QQcl.8729456a4d2047ea7abbfbcf95967e44 = linkonce constant [72 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_668/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.8729456a4d2047ea7abbfbcf95967e44, i32 6)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  store i64 1, ptr getelementptr inbounds ([2000 x i64], ptr @_QFEdp, i64 0, i64 2), align 16, !tbaa !3
  %5 = load i32, ptr %1, align 4, !tbaa !3
  %6 = icmp sgt i32 %5, 3
  br i1 %6, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %7 = zext i32 %5 to i64
  %8 = add nsw i64 %7, -3
  %xtraiter = and i64 %8, 1
  %9 = icmp eq i32 %5, 4
  br i1 %9, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %8, -2
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %10 = phi i64 [ 1, %.lr.ph.preheader.new ], [ %22, %.lr.ph ]
  %indvars.iv = phi i64 [ 4, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %11 = add nsw i64 %indvars.iv, -1
  %12 = add nsw i64 %indvars.iv, -4
  %13 = getelementptr [2000 x i64], ptr @_QFEdp, i64 0, i64 %12
  %14 = load i64, ptr %13, align 16, !tbaa !3
  %15 = add i64 %14, %10
  %16 = srem i64 %15, 1000000007
  %17 = getelementptr [2000 x i64], ptr @_QFEdp, i64 0, i64 %11
  store i64 %16, ptr %17, align 8, !tbaa !3
  %18 = add nsw i64 %indvars.iv, -3
  %19 = getelementptr [2000 x i64], ptr @_QFEdp, i64 0, i64 %18
  %20 = load i64, ptr %19, align 8, !tbaa !3
  %21 = add i64 %20, %16
  %22 = srem i64 %21, 1000000007
  %23 = getelementptr [2000 x i64], ptr @_QFEdp, i64 0, i64 %indvars.iv
  store i64 %22, ptr %23, align 16, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %22, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ 4, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %24 = add nsw i64 %indvars.iv.unr, -1
  %25 = add nsw i64 %indvars.iv.unr, -4
  %26 = getelementptr [2000 x i64], ptr @_QFEdp, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !3
  %28 = add i64 %27, %.unr
  %29 = srem i64 %28, 1000000007
  %30 = getelementptr [2000 x i64], ptr @_QFEdp, i64 0, i64 %24
  store i64 %29, ptr %30, align 8, !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %0
  %31 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.8729456a4d2047ea7abbfbcf95967e44, i32 11)
  %32 = load i32, ptr %1, align 4, !tbaa !3
  %33 = sext i32 %32 to i64
  %34 = add nsw i64 %33, -1
  %35 = getelementptr [2000 x i64], ptr @_QFEdp, i64 0, i64 %34
  %36 = load i64, ptr %35, align 8, !tbaa !3
  %37 = call i1 @_FortranAioOutputInteger64(ptr %31, i64 %36)
  %38 = call i32 @_FortranAioEndIoStatement(ptr %31)
  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 ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

!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"}
