integer L,R
integer ans
read*,L,R
if(R-L>=2018)then
  print"(i0)",0
  stop
endif

L=mod(L,2019)
R=mod(R,2019)
if(R<L)then
  print"(i0)",0
  stop
endif

ans=2019
do i=L,R-1
  do j=L+1,R
    ans=min(ans,mod(i*j,2019))
  end do
end do

print"(i0)",ans

end
; 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"

@_QQcl.43d592d5508c10f4bc9351dec6db209e = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3806/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 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.43d592d5508c10f4bc9351dec6db209e, i32 3)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 4)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i32, ptr %2, align 4, !tbaa !3
  %8 = load i32, ptr %1, align 4, !tbaa !3
  %9 = sub i32 %7, %8
  %10 = icmp sgt i32 %9, 2017
  br i1 %10, label %11, label %16

11:                                               ; preds = %0
  %12 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.43d592d5508c10f4bc9351dec6db209e, i32 5)
  %13 = call i1 @_FortranAioOutputInteger32(ptr %12, i32 0)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %12)
  %15 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

16:                                               ; preds = %0
  %17 = srem i32 %8, 2019
  store i32 %17, ptr %1, align 4, !tbaa !3
  %18 = srem i32 %7, 2019
  store i32 %18, ptr %2, align 4, !tbaa !3
  %19 = icmp slt i32 %18, %17
  br i1 %19, label %20, label %25

20:                                               ; preds = %16
  %21 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.43d592d5508c10f4bc9351dec6db209e, i32 12)
  %22 = call i1 @_FortranAioOutputInteger32(ptr %21, i32 0)
  %23 = call i32 @_FortranAioEndIoStatement(ptr %21)
  %24 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

25:                                               ; preds = %16
  %narrow10 = sub nsw i32 %18, %17
  %26 = icmp sgt i32 %narrow10, 0
  br i1 %26, label %.lr.ph.us.preheader, label %._crit_edge16

.lr.ph.us.preheader:                              ; preds = %25
  %27 = zext i32 %narrow10 to i64
  %min.iters.check = icmp ult i32 %narrow10, 8
  %n.vec = and i64 %27, 4294967288
  %ind.end = and i64 %27, 7
  %.cast = trunc i64 %n.vec to i32
  %ind.end19 = add i32 %17, %.cast
  %.splatinsert = insertelement <4 x i32> poison, i32 %17, i64 0
  %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %induction = add <4 x i32> %.splat, <i32 0, i32 1, i32 2, i32 3>
  %cmp.n = icmp eq i64 %n.vec, %27
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %28 = phi i64 [ %48, %._crit_edge.us ], [ %27, %.lr.ph.us.preheader ]
  %29 = phi i32 [ %47, %._crit_edge.us ], [ %17, %.lr.ph.us.preheader ]
  %.013.us = phi i32 [ %.lcssa, %._crit_edge.us ], [ 2019, %.lr.ph.us.preheader ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.us
  %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %.013.us, i64 0
  %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %29, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert23 = insertelement <4 x i32> poison, i32 %29, i64 0
  %broadcast.splat24 = shufflevector <4 x i32> %broadcast.splatinsert23, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %36, %vector.body ]
  %vec.phi22 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %37, %vector.body ]
  %30 = add nsw <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
  %31 = add <4 x i32> %vec.ind, <i32 5, i32 5, i32 5, i32 5>
  %32 = mul <4 x i32> %30, %broadcast.splat
  %33 = mul <4 x i32> %31, %broadcast.splat24
  %34 = srem <4 x i32> %32, <i32 2019, i32 2019, i32 2019, i32 2019>
  %35 = srem <4 x i32> %33, <i32 2019, i32 2019, i32 2019, i32 2019>
  %36 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %34)
  %37 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi22, <4 x i32> %35)
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %38 = icmp eq i64 %index.next, %n.vec
  br i1 %38, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %rdx.minmax.select = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %36, <4 x i32> %37)
  %39 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax.select)
  br i1 %cmp.n, label %._crit_edge.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph.us, %middle.block
  %.ph = phi i64 [ %27, %.lr.ph.us ], [ %ind.end, %middle.block ]
  %.in.ph = phi i32 [ %17, %.lr.ph.us ], [ %ind.end19, %middle.block ]
  %.112.us.ph = phi i32 [ %.013.us, %.lr.ph.us ], [ %39, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %40 = phi i64 [ %45, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %.in = phi i32 [ %41, %scalar.ph ], [ %.in.ph, %scalar.ph.preheader ]
  %.112.us = phi i32 [ %44, %scalar.ph ], [ %.112.us.ph, %scalar.ph.preheader ]
  %41 = add nsw i32 %.in, 1
  %42 = mul i32 %41, %29
  %43 = srem i32 %42, 2019
  %44 = call i32 @llvm.smin.i32(i32 %.112.us, i32 %43)
  %45 = add nsw i64 %40, -1
  %46 = icmp sgt i64 %40, 1
  br i1 %46, label %scalar.ph, label %._crit_edge.us, !llvm.loop !10

._crit_edge.us:                                   ; preds = %scalar.ph, %middle.block
  %.lcssa = phi i32 [ %39, %middle.block ], [ %44, %scalar.ph ]
  %47 = add nsw i32 %29, 1
  %48 = add nsw i64 %28, -1
  %49 = icmp sgt i64 %28, 1
  br i1 %49, label %.lr.ph.us, label %._crit_edge16

._crit_edge16:                                    ; preds = %._crit_edge.us, %25
  %.0.lcssa = phi i32 [ 2019, %25 ], [ %.lcssa, %._crit_edge.us ]
  %50 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.43d592d5508c10f4bc9351dec6db209e, i32 23)
  %51 = call i1 @_FortranAioOutputInteger32(ptr %50, i32 %.0.lcssa)
  %52 = call i32 @_FortranAioEndIoStatement(ptr %50)
  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 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #1

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind 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 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = distinct !{!10, !9, !8}
