program ABC133C
    implicit none
    integer(8)::L,R,ans,i,j
    read*,L,R

    if(R/2019-(L-1)/2019>=1)then
        print'(i0)',0
    else
        ans=2019
        do i=L,R-1
            do j=i+1,R
                ans=min(ans,mod(i*j,2019))
            end do
        end do
        print'(i0)',ans
    end if
end program ABC133C
; 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.3813a0667685b7946db37c83f25327c2 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3809/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 i64, align 8
  %2 = alloca i64, align 8
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.3813a0667685b7946db37c83f25327c2, i32 4)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 8)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 8)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i64, ptr %2, align 8, !tbaa !3
  %8 = sdiv i64 %7, 2019
  %9 = load i64, ptr %1, align 8, !tbaa !3
  %10 = add i64 %9, -1
  %.neg = sdiv i64 %10, -2019
  %11 = add nsw i64 %.neg, %8
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %13, label %16

13:                                               ; preds = %0
  %14 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.3813a0667685b7946db37c83f25327c2, i32 7)
  %15 = call i1 @_FortranAioOutputInteger32(ptr %14, i32 0)
  br label %35

16:                                               ; preds = %0
  %17 = sub i64 %7, %9
  %18 = icmp sgt i64 %17, 0
  br i1 %18, label %.lr.ph.preheader, label %._crit_edge14

.lr.ph.preheader:                                 ; preds = %16, %._crit_edge
  %19 = phi i64 [ %31, %._crit_edge ], [ %17, %16 ]
  %20 = phi i64 [ %21, %._crit_edge ], [ %9, %16 ]
  %.011 = phi i64 [ %27, %._crit_edge ], [ 2019, %16 ]
  %21 = add i64 %20, 1
  %22 = sub i64 %7, %20
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %23 = phi i64 [ %29, %.lr.ph ], [ %22, %.lr.ph.preheader ]
  %24 = phi i64 [ %28, %.lr.ph ], [ %21, %.lr.ph.preheader ]
  %.110 = phi i64 [ %27, %.lr.ph ], [ %.011, %.lr.ph.preheader ]
  %25 = mul i64 %24, %20
  %26 = srem i64 %25, 2019
  %27 = call i64 @llvm.smin.i64(i64 %.110, i64 %26)
  %28 = add i64 %24, 1
  %29 = add nsw i64 %23, -1
  %30 = icmp sgt i64 %23, 1
  br i1 %30, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph
  %31 = add nsw i64 %19, -1
  %32 = icmp sgt i64 %19, 1
  br i1 %32, label %.lr.ph.preheader, label %._crit_edge14

._crit_edge14:                                    ; preds = %._crit_edge, %16
  %.0.lcssa = phi i64 [ 2019, %16 ], [ %27, %._crit_edge ]
  %33 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.3813a0667685b7946db37c83f25327c2, i32 15)
  %34 = call i1 @_FortranAioOutputInteger64(ptr %33, i64 %.0.lcssa)
  br label %35

35:                                               ; preds = %13, %._crit_edge14
  %.sink = phi ptr [ %14, %13 ], [ %33, %._crit_edge14 ]
  %36 = 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 ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

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

attributes #0 = { 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"}
