peterverebics/CodeNet_Python_118 huggingface dataset:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    l,r=pin()
    L=l%2019
    R=r%2019
    #print(L,R)
    if r-l>=2019:R+=2019


    t=20192019
    for i in range(L,R):
        for j in range(i+1,R+1):
            t=min(t,(i*j)%2019)
    print(t)
#%%submit!
resolve()
from itertools import combinations
L,R = (int(x) for x in input().split())
ans = 2018
if (R-L) // 2018 >= 1:
    print('0')
else:
    for x in combinations(range(L,R+1),2):
        ans = min(ans,x[0]*x[1]%2019)
    print(ans)
import sys
l,r=map(int,input().split())
if l+2019<=r:
  print(0)
  sys.exit()
mn=2018*2018
for i in range(l,r+1):
  for j in range(i+1,r+1):
    mn=min(mn,i*j%2019)
print(mn)
a,b = map(int,input().split())
min_mod = 2018

if b-a > 2019:
	min_mod=0

else:	
	for aa in range(a,b):
	   for bb in range(a+1,b+1):
	       if aa < bb:
	           cc=aa*bb
	 
	           if min_mod > cc%2019:
	               min_mod = cc%2019

print(min_mod)
l, r = map(int, input().split())

ans = 2019
for i in range(l, r):
    for j in range(l+1, r+1):
        tmp = i*j % 2019
        if ans > tmp:
            ans = tmp
        if ans == 0:
            print(ans)
            exit(0)
print(ans)
L,R = map(int,input().split())
 
cnt = 0
i = L
j = L+1
min_num = 2020
while i <= R and cnt <= 2019:
    j = i+1
    while j <= R:
        min_num = min(min_num,(i*j)%2019)
        if not min_num:
            break
        j += 1
    i += 1
    cnt += 1
print(min_num)
l,r=map(int,input().split())
if r-l>=2018:print(0);exit()
r-=l//2019*2019
l%=2019
ans=2019
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans=min(ans,(i*j)%2019)
print(ans)
N, K = map(int,input().split())
ans = float('inf')
for i in range(N,K):
    for j in range(i+1,K+1):
        mod = (i*j)%2019
        ans = min(mod, ans)
        if mod==0:
            break
    else:
        continue
    break
print(ans)
import itertools
import math
l, r = map(int, input().split())


if(abs(l-r) > 2050): print(0)
else:
    num = []
    for i in range(l,r+1):
        num.append(i)
    minimum = 10**9
    for v in itertools.combinations(num, 2):
        minimum = min(minimum,v[0]*v[1]%2019)
    print(minimum)
L,R = map(int, input().split())
if R-L > 2017:
    print(0)
    exit()
ans = 2018
for i in range(L, R+1):
    for j in range(i+1, R+1):
        ans = min(ans, i*j%2019)
print(ans)
L,R=map(int,input().split())
_min=2018
if L==0:
  _min=0
else:  
  for l in range(L,L+2019):
    if l>R:
      break
    for r in range(l+1,l+2020):
      if r>R:
        break
      m=(l*r)%2019
      if _min>m:
        _min=m
print(_min)
l,r=map(int,input().split())
a=range(l,r+1)[:673]
print(min(i*j % 2019 for i in a for j in a if i<j))
L, R = map(int, input().split())
if R - L >= 2019:
    ans = 0
else:
    ans = 2018
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            a = (i * j) % 2019
            if ans > a:
                ans = a
            if ans == 1:
                break
print(ans)
l,r=map(int,input().split())
ans=int(10000000)
if r-l>2019:
    print(0)
    exit()

for i in range(l,r):
    for j in range(i+1,r+1):
        now=int((i*j)%2019)
        if ans>now:
            ans=now

print(ans)
l, r = [int(x) for x in input().split()]
NUM = 2019
if r // NUM - (l + NUM - 1) // NUM >= 0: #2019の倍数を区間に含む
    res = 0
elif r // 3 - (l + 3 - 1) // 3 >= 0 and r // 673 - (l + 673 - 1) // 673 >= 0:
    res = 0
else: #mod 2019 = 0にできない場合
    res = 2019
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            res = min(res, (i * j) % NUM)
print(res)
l,r=map(int,input().split())
m=2019
c=m-1
r=min(r,l+m-1)
for i in range(l,r):
    for j in range(i+1,r+1):
        s=i*j
        c=min(c,s%m)
print(c)
l,r=map(int,input().split())

mod=2019
ijmin=2019
for i in range(l,min(r,l+2019)+1):
    for j in range(i+1,min(r,i+2019)+1):
        ijmin=min((i*j)%mod,ijmin)
#        print(i,j,(i*j)%mod,ijmin)
print(ijmin)
l, r = map(int, input().split())
x = 2018

if r - l >=2019:
  x = 0
  
else:
  for i in range(l,r):
    for j in range(i+1, r+1):
      if (i * j) % 2019 < x:
        x = (i * j) % 2019
        
print(x)
L, R = [int(i) for i in input().split()]
min = 1 << 30
for i in range(L, R + 1):
    if i % 2019 == 0:
        print(0)
        exit()
L %= 2019
R %= 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        if i * j % 2019 < min:
            min = i*j % 2019
print(min)
l, r = map(int, input().split())
ans = float('inf')
for i in range(l, r):
    for j in range(i+1, r+1):
        if (i*j)%2019 == 0:
            print(0)
            exit()
        ans = min(ans, (i*j)%2019)
print(ans)
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
w = R - L
if l + w >= 2019:
  print(0)
else:
  ans = 2019
  for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
      ans = min(ans, (i * j) % 2019)
  print(ans)
L,R = map(int,input().split())
ans = 0

if R-L < 2018:
  nums = list(range(L,R+1))
  A = []
  for i in range(len(nums)):
    for j in range(i+1,len(nums)):
      A.append((nums[i]*nums[j])%2019)
  ans = min(A)

print(ans)
L, R = map(int, input().split())
target = R+1
if R - L > 10000:
    target = L + 10000
mi = 2019
for i in range(L,target):
    for j in range(i+1,target):
        mi = min(mi,(i*j)%2019)
print(mi)
l, r = map(int, input().split())
if r - l + 1 >= 2019:
  print(0)
else:
  ans = 2019
  for i in range(l, r):
    for j in range(i+1, r+1):
      mod = (i*j) % 2019
      ans = min(ans, mod)
  print(ans)
L, R = map(int, input().split())

ans = 2019
for i in range(L, L+2020-1):
    for j in range(i+1, i+2020):
        if j > R: break
        ans = min((i*j)%2019, ans)
print(ans)
l, r = map(int, input().split())

ans = float('inf')
for i in range(l, min(r, l + 2019)):
    for j in range(i + 1, min(r + 1, l + 2019 + 1)):
        x = i * j % 2019
        ans = min(ans, x)
        
print(ans)
L ,R = map(int,input().split())

ans =[]
for i in range(L,R+1):
    for j in range(i+1,R+1):
        ans.append(i*j%2019)
        if (i * j % 2019) == 0:
            break
    else:
        continue
    break

print(min(ans))
L, R = map(int, input().split())
li = []

if R-L >= 2018:
  ans = 0
else:
  for i in range(L, R+1):
    l = i % 2019
    li.append(l)
  ans = 10000
  for i in range(len(li)-1):
    for j in range(i+1, len(li)):
      ans = min((li[i]*li[j])%2019, ans)
  
print(ans)
l,r=map(int,input().split())

d=[int(i) for i in range(2019)]

a=l%2019
b=r%2019

if a<b:
    if r-l<2019:
        d=d[a:b+1]
    else:
        d=d
elif a>b:
    if r-l<2019:
        d=d[b:a+1]
    else:
        d=d
else:
    d=d
    
ans=2019
for i in range(len(d)):
    for j in range(i+1,len(d)):
        ans=min(ans,(d[i]*d[j])%2019)
print(ans)
L,R = map(int,input().split())

R = min(R,L+2019)

ans = 2019
for i in range(L,R):
    for j in range(i+1,R+1):
        ans = min(ans,i*j%2019)

print(ans)
L, R = map(int, input().split())

import sys

mi=10**10
for l in range(L,R+1):
    for r in range(l+1,R+1):
        mod = (l*r) % 2019
        if mod < mi:
            mi=mod
        if mi==0:
            print(mi)
            sys.exit()
print(mi)
l,r=map(int,input().split())

ans=10000
for i in range(l,r):
  for j in range(i+1,r+1):
    ans=min(ans,(i*j)%2019)
    if ans==0:
      print(0)
      exit()
print(ans)
L, R = map(int, input().split())
if R-L >= 2018:
    print(0)
else:
    m = 10**6
    for i in range(L, R):
        for j in range(i+1, R+1):
            m = min((i*j)%2019, m)
    print(m)
import sys

def solve():
    input = sys.stdin.readline
    L, R = map(int, input().split())
    if R - L >= 2019: print(0)
    else:
        minMod = 2019
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                minMod = min((i * j) % 2019, minMod)
        print(minMod)

    return 0

if __name__ == "__main__":
    solve()
mod, min_value = 2019, 2019
l, r = map(int, input().split())
length = r - l
for i in range(mod):
  for j in range(mod):
    if length - j - i <= 0 or min_value == 0:
      break
    min_value = min(min_value, (l + i) * (r - j) % mod)
print(min_value)
l,r=map(int,input().split())
if abs(l-r)>=673:
  print(0)
else:
  ans=float('inf')
  for i in range(l,r):
    for j in range(i+1,r+1):
      ans=min((i*j)%2019,ans)
  print(ans)
L, R = map(int, input().split())
pred = 2019
if (R)-(L)>2019:
    print(0)
else:
    for i in range(L,R+1):
        for j in range(i+1, R+1):
            if (i*j)%2019 < pred:
                pred = (i*j)%2019
            else:
                pass
    print(pred)
L,R=map(int,input().split())
l,r=L%2019,R%2019
x,y=L//2019,R//2019
if x<y:
  print(0)
else:
  ans=10**9
  for i in range(l,r):
    for j in range(i+1,r+1):
      ans=min(ans,(i*j)%2019)
  print(ans)
l, r = map(int, input().split())
ans = 10**10
for i in range(l, r+1):
    for j in range(i+1, r+1):
        ans = min(ans, (i*j)%(2019))
        if i*j%2019==0:
            break
    if i*j%2019==0:
        break
print(ans)
l,r=map(int,input().split())

if l//2019==r//2019:
    ans=float('INF')
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans=min(ans,(i*j)%2019)
    print(ans)
else:
    print(0)
L,R = map(int,input().split())
r = 2019
if R//2019 != L//2019:
    print(0)
else:
    Rmod = R%2019
    Lmod = L%2019
    for i in range(Lmod,Rmod+1):
        for j in range(i+1,Rmod+1):
            r = min(r,(i*j)%2019)
    print(r)
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
if R - L >= 2019 or l > r:
    print(0)
elif r - l == 1:
    print((l * r) % 2019)
else:
    mod2019 = []
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            mod2019.append((i * j) % 2019)
    mod2019 = sorted(mod2019)
    print(mod2019[0])
L, R = map(int, input().split())
if R - L < 2019:
    ans = float('inf')
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            ans = min(ans, i * j  % 2019)
    print(ans)
else:
    print(0)
L,R=map(int,input().split())
if R-L>=2019:
	print(0)
else:
	ans=2018
	for i in range(L,R+1):
		for j in range(i+1,R+1):
			ans=min(ans,(i*j)%2019)
	print(ans)
l,r = map(int, input().split())
if l//2019 != r//2019:
  print(0)
  exit(0)
l = l%2019
r = r%2019
a = 2019
for i in range(l,r+1):
  for j in range(l,i):
    a = min(a,(i*j)%2019)
    if a == 0:
      print(0)
      exit(0)
print(a)
import sys, heapq, bisect, math, fractions
from collections import deque

mod = 2019
L, R = map(int, input().split())

res = 10 ** 15
if R - L > 2030:
    res = 0
else:
    for l in range(L, R):
        for r in range(l + 1, R + 1):
            res = min(res, (l * r) % mod)

print(res)
L, R = map(int, input().split())
 
# 例：L=3000, R=10000 で考える
# (i,j)=(3000,3001)から始まり、(3000,5018)で最小(=0)
 
# R-L>=2018 のとき、(L,L+1),...,(L,L+2018)の間で最小値0を取れる
# それ以外のとき、全探索してもO((10^3)^2)で間に合う！
if R-L >= 2018:
  print(0)
else:
  m = 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      m = min(m, i*j % 2019)
  print(m)
l,r=map(int, input().split())
import sys
ans = 2018
for i in range(l,r):
    for j in range(i+1,r+1):
        a = (i*j) % 2019
        if a < ans:
            ans = a
        if ans == 0:
            print(ans)
            sys.exit()
print(ans)
L, R = map(int, input().split())

mod = 2019
min_num = float("inf")

tmp_L = L

while tmp_L < R and tmp_L <= L + 2019:
    tmp_R = tmp_L + 1

    while tmp_R <= R and tmp_R <= tmp_L + 2019:
        min_num = min((tmp_L*tmp_R)%mod ,min_num)
        tmp_R += 1
    tmp_L = tmp_L + 1

print(min_num)
# AtCoder Beginner Contest 133
# C - Remainder Minimization 2019
L,R=map(int,input().split())

mod=2019
ans=10**18+7


for i in range (L,min(R,L+mod)):
    for j in range (L+1,min(R+1,L+mod+1)):
        tempans=(i%mod)*(j%mod)
        tempans%=mod
        # print(i,j,tempans)
        if tempans<ans:
            ans=tempans
print(ans)
l,r = map(int,input().split())
if r-l>=2019:
    print(0)
    exit()
ans = 2019
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans = min(ans,(i*j)%2019)
print(ans)
L, R = map(int,input().split())
if R-L>=2018:
    print(0)
else:
    lst = [i%2019 for i in range(L,R+1)]
    lst = set(lst)
    lst = list(lst)
    N = len(lst)
    ans = 10**8
    for i in range(N-1):
        for j in range(i+1,N):
            if ans>(lst[i]*lst[j])%2019:
                ans = (lst[i]*lst[j])%2019
    print(ans)
l, r = map(int, input().split())
result = 10 ** 9
if r-l == 1:
  result = (l*r) % 2019
else:
  r = min(r, l + 2019)
  for i in range(l, r+1):
    for j in range(l, r+1):
      if i < j:
        result = min(result, (i*j)%2019)
        
print(result)
def ABC133C(l, r):
    Min = 1e10
    for i in range(l, r):
        for j in range(i+1, r+1):
            a = (i * j) % 2019
            if a < Min:
                Min = a
                if a == 0: # ここに注目
                    print(Min)
                    return
    print(Min)

l, r = map(int, input().split())
ABC133C(l, r)
#C
l, r = map(int, input().split())

if r - l >= 2018:
    print(0)
else:
    ans = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            ans = min(ans, i * j % 2019)
            #print(ans)
    print(ans)
import numpy as np
a, b = map(int, input().split())
if b - a >= 2019:
  print(0)
  
else:
  all_ = np.mod([i for i in range(a, b+1)], 2019)
  all_ = np.outer(all_, all_)
  n = all_.shape[0]
  all_ = np.mod(all_ * (np.ones((n,n)) - np.eye(n)) + np.eye(n) * 2018, 2019)
  print(int(all_.min()))
L,R = map(int,input().split())
A = []
for i in range(min((R-L), 2020)):
    for j in range(i+1, min((R-L+1), 2021)):
        A.append((i+L)*(j+L)%2019)
print(min(A))
l,r=map(int,input().split())

ans=10000
for i in range(l,l+min(r-l,2020)):
  for j in range(i+1,l+min(r-l,2020)+1):
    ans=min(ans,(i*j)%2019)

print(ans)
import sys

L,R=map(int,input().split())
M=2019

R=min(R,L+2*M-1)

X=M+1
for i in range(L,R+1):
    for j in range(i+1,R+1):
        X=min(X,(i*j)%M)
print(X)
L,R = map(int,input().split())
if R - L >= 2019:
    ans = 0
else:
    ans = R*R
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans = min(ans,(i*j)%2019)
print(ans)
def main():
    ans = 10**19
    l, r = map(int, input().split())
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            ans = min(ans, (i * j) % 2019)
            if ans == 0:
                print(0)
                return
    print(ans)              
        
    
if __name__ == '__main__':
    main()
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
L,R = map(int,input().split())

ans = 2019
for i in range(L,R+1):
    if ans==0:
        break
    for j in range(i+1,R+1):
        ans = min(ans, (i*j)%2019)
        if ans==0:
            break

print(ans)
l,r=map(int,input().split())
s=range(l,r+1)[:2019]
print(min(i*j%2019for i in s for j in s if i<j))
l, r = map(int, input().split())
if r - l > 2030: print(0)
else:
    ans = 2018
    for i in range(l, r):
        for j in range(i+1, r+1):
            ans_ = i*j%2019
            if ans_ < ans:
                ans = ans_
    print(ans)
l, r = map(int, input().split())
ll = l % 2019
rr = r % 2019
minn = 2019
if r - l > 2019:
    rr += 2019
for i in range(ll, rr):
    for j in range(ll + i - ll + 1, rr + 1):
        if minn > i * j % 2019:
            minn = i * j % 2019
print(minn)
L, R = map(int, input().split())
mod = 2019
ans = 2018
for i in range(L, R):
    for j in range(i+1, R+1):
        if ans >= i*j%mod:
            ans = i*j%mod
        if ans == 0:
            break

    if ans == 0:
        break

print(ans)
l, r = map(int, input().split())
ans = float('inf')
for i in range(l, min(l+2019, r)+1):
    for j in range(i+1, min(l+2019, r)+1):
        ans = min(ans, (i*j)%2019)
print(ans)
l, r = map(int, input().split())

if r - l >= 2019:
    print(0)
    exit()

ans = 2019

for i in range(l, r):
    for j in range(i+1, r+1):
        ans = min(ans, (i*j)%2019)

print(ans)
L,R = map(int,input().split())
m = 2019
sa = R//m - L//m
if sa == 0:
  ans = float("inf")
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      ans = min(ans,i*j%m)
  print(ans)
if sa >= 1:
  print(0)
l,r=map(int,input().split())
i=1
temp=0
while r>2019*i:
  if l<=2019*i:
    temp=1
    break
  i=i+1

count=2019
r=r%2019
l=l%2019
for i in range(l,r+1):
  for j in range(i+1,r+1):
    temp1=(i*j)%2019
    count=min(count,temp1)

if temp==1:
  print(0)
else:
  print(count)
l, r = map(int, input().split())

arr = []
for i in range(l,l+2019+1):
    for j in range(i+1,i+2019+1):
        if j > r:
            break
        else:
            arr.append((i * j) % 2019)
        
print(min(arr))
l, r = map( int, input().split())

amr = []
for x in range(l,r+1):
    if len(amr) >= 2019:
        break
    amr.append(x%2019)
# print(amr)
amr = list(set(amr))
ij_mod = []
for i in range(len(amr)-1):
    for j in range(i+1,len(amr)):
        ij_mod.append((amr[i]*amr[j])%2019)
print(min(ij_mod))
L, R = list(map(int,input().split()))

if(R - L) >= 2019:
    print(0)
    exit()
 
ans = float('inf')
for i in range(L, R):
    for j in range(i+1, R+1):
        t = i*j%2019
        ans = min(ans,t)
print(ans)
L, R = map(int, input().split())

if (R-L) >= 2018:
    print(0)
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            ans = min(ans, (i*j)%2019)
    print(ans)
L, R = map(int, input().split())
ans = 2019
R = min([R, L+2019])
for i in range(L, R+1):
    for j in range(i+1, R+1):
        res = (i*j)%2019
        ans = min([res, ans])
print(ans)
L, R = map(int, input().split())
def mod(L, R):
    ans = []
    for i in range(L, R):
        for j in range(L+1, R+1):
            if (i*j)%2019 == 0:
                return 0
            ans.append((i*j)%2019)
    return min(ans)
print(mod(L, R))
a, b = map(int, input().split())
ans = 20000000
n = a//2019
m = b//2019
a = a % 2019
b = b % 2019

if a > b:
    ans = 0
else:
    for i in range(a, b):
        for j in range(a+1, b+1):
            ans = min(ans, i*j%2019)
if m != n:
    ans = 0

if a == b:
    ans = 0

print(ans)
L, R = map(int, input().split())

ans = 2*10**9+1
for i in range(L, min(R, L+2019)+1):
    for j in range(i+1, min(R, L+2019)+1):
        i %= 2019
        j %= 2019
        ans = min(ans, (i*j)%2019)
print(ans)
l, r = map(int, input().split())
ans = 2020

for i in range(l, min(r + 1, l + 4040)):
    for j in range(i + 1, min(r + 1, l + 4040)):
        if i * j % 2019 < ans:
            ans = i * j % 2019
print(ans)
MOD = 2019
L, R = map(int, input().split())
res = MOD
if R - L < MOD:
    for l in range(L, R):
        for r in range(l+1, R+1):
            res = min(res, (l * r) % MOD)
else:
    res = 0
print(res)
L, R = list(map(int,input().split()))
if R - L >= 690:
    ans = 0
else:
    ans = 10 ** 9 + 7
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i * j) % 2019)
print(ans)
L,R = map(int, input().split())
l = L//2019
r = R//2019
m = L%2019
n = R%2019

ans = 2018
if l != r:
  print(0)
  exit()
else:
  for i in range(m,n):
    for j in range(i+1,n+1):
      ans = min((i*j) % 2019, ans)
      if ans == 0:
        print(ans)
        exit()
      
print(ans)
# ume 20/03/18

def main():
  l,r=map(int,input().split())
  if r-l>2018:
    return 0
  else:
    c=2019
    for i in range(l,r):
      for j in range(i+1,r+1):
        c=min(c,i*j%2019)
        if c==0: return c
    return c

if __name__ == '__main__':
  print(main())
l , r = map(int, input().split())
apple = []
if r - l >= 678:
    apple.append(0)
else:
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            apple.append((i * j) % 2019)
print(min(apple))
L, R = map(int,input().split())
mod = 2019

ans = 2019
if R - L >= 2019:
  print(0)
else:
  for i in range(L, R):
    for j in range(i+1, R+1):
      val = ((i%mod) * (j%mod))%mod
      ans = min(ans, val)
  print(ans)
import numpy as np
a,b = map(int, input().split())
mod = 2019
min_score = 2019

for i in range(a, b+1):
    for j in range(a, b+1):
        if i != j:
            temp = (i)*(j) %mod
            if min_score > temp:
                min_score = temp
            if min_score == 0:
                print(min_score)
                exit()

print(min_score)
import sys
input = sys.stdin.readline
l, r = map(int, input().split())
ans = 2019
for i in range(l, r+1):
    for j in range(i+1, r+1):
        tmp = 0
        tmp = i * j % 2019
        ans = min(ans, tmp)
        if ans == 0:
            print(ans)
            exit()
print(ans)
def main():
    l, r = map(int, input().split())
    mi = 2019
    c = 0

    for i in range(l, r):
        a = (i*i) % 2019
        for _ in range(min(r-l-c, 2019)):
            a = (a+i) % 2019

            if a < mi:
                mi = a
                if a == 0:
                    print(0)
                    return 
        c += 1

    print(mi)


if __name__ == '__main__':
    main()
import sys
l, r = map(int, input().split())
ans = []
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        ans.append((i * j) % 2019)
        if (i * j) % 2019 == 0:
            print(0)
            sys.exit()
print(min(ans))
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    l, r = list(map(int, readline().split()))
    t = 10 ** 20
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            t = min(t, i * j % 2019)
            if t == 0:
                break
        if t == 0:
            break
    print(t)


if __name__ == '__main__':
    solve()
l, r = map(int, input().split())

if r-l >= 673:
    print(0)
    exit()
else:
    ans = 2018
    for i in range(l, r):
        for j in range(i+1, r+1):
            ans = min(ans, i*j%2019)
    print(ans)
l,r = map(int, input().split())
if r - l > 2019:
    ans = 0
else:
    ans = 2018
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans, i*j%2019)
print(ans)
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

L, R = map(int, input().split())


MOD = 2019

l = L % 2019
r = R % 2019

if (R//MOD) - (L//MOD) > 0:
    r += 2019

res = 2019
for i in range(l, r):
    for j in range(i+1, r+1):
        res = min((i * j) % MOD, res)

print(res)
L, R = map(int, input().split())

minimize = 2018
P = 0

if R-L >= 2019:
	print(0)
	exit()
else:
	for i in range (L, R):
		for j in range (i+1, R+1):
			P = (i*j)%2019
			if P < minimize:
				minimize = P
print(minimize)
L, R = map(int, input().split())
modL = L % 2019
modR = R % 2019
min2019 = 2019

if R - L >= 2018:
    print(0)
else:
    for j in range(modL, modR+1):
        for k in range(j+1 , modR+1):
            min2019 = min(min2019, j * k % 2019)
    print(min2019)
L,R = map(int,input().split())

def rem(L, R):
  if (R//2019) - (L//2019) > 0:
    return 0
  L = L % 2019
  R = R % 2019
  res = 2018
  for i in range(L, R):
    for j in range(i+1, R+1):
      m = (i*j)%2019
      if res > m:
        res = m
  return res

print(rem(L, R))
l,r = map(int,input().split())
ans = float('inf')
if r-l>=2019: ans = 0
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%2019)
print(ans)
L, R = map(int, input().split())

m = 2019

if R - L > 2100:
    print(0)
else:
    tmp_min = 2018
    for i in range(L, R):
        mod_i = i % m
        for j in range(i + 1, R+1):
            mod = (mod_i * j) % m
            if tmp_min > mod:
                tmp_min = mod
    print(tmp_min)
import sys

L,R = map(int, input().split())

if R - L >= 2020:
  print(0)
  sys.exit()

m = 10**9

for i in range(L, R+1):
  for n in range(i+1, R+1):
    s = i * n % 2019

    if m > s:
      m = s

print(m)