peterverebics/CodeNet_Python_118 huggingface dataset:
L, R = map(int, input().split())

if L//2019 == R//2019:
  num = float("inf")
  for i in range(L%2019, R%2019):
    for j in range(i+1, R%2019+1):
      if num >= (i*j)%2019:
        num = (i*j)%2019
  print(num)
else:
  num = float("inf")
  for i in range(L%2019, 2018):
    for j in range(i+1, 2019):
      if num >= (i*j)%2019:
        num = (i*j)%2019
  print(num)
L,R=map(int,input().split())
l=L%2019
r=R%2019
#print(l,r)
if l<r and L//2019 == R//2019:
    print((L*(L+1))%2019)
elif L//2019<R//2019:
    print(0)
l,r=map(int,input().split())
ans=l*r
if l//2019!=r//2019:
    ans=0
elif l%2019==0 or r%2019==0:
    ans=0
else:
    num1=l%2019
    num2=r%2019
    for i in range(num1,num2):
        for j in range(i+1,num2+1):
            num=(i*j)%2019
            if ans>num:
                ans=num
        if ans==1:
            break
print(ans)
from operator import itemgetter
i, j = map(int, input().split())
MOD = 2019
rangee = sorted([[x, x % MOD] for x in range(i, min(j+1, i+MOD+1))], key=itemgetter(1))
print(rangee[0][0] % MOD * rangee[1][0] % MOD)
l, r = map(int, input().split())
if l%2019 < r%2019:
    print((l%2019 * (l+1)%2019)%2019)
else:
    print((r%2019 * (r-1)%2019)%2019)
L, R = map(int, input().split())

A = []
k = L % 2019
for _ in range(min(R - L + 1, 2019 * 2)):
    A.append(k)
    k = (k + 1) % 2019

A.sort()
print((A[0] * A[1]) % 2019)
L, R = map(int, input().split())
i = 2017
j = 2018
i_mod = 2017
j_mod = 2018
end = min(R, L + 4038)

for n in range(L, (end + 1)):
    n_mod = n % 2019
    if n_mod == 0:
        continue
    elif n_mod < i_mod:
        i, j = n, i
        i_mod = n_mod
    elif n_mod < j_mod:
        j = n
        j_mod = n_mod

print((i * j) % 2019)
L, R = map(int, input().split())
MOD = 2019
# L = 2020
# R = 2040
diff = (R - L) % MOD if (R - L) % MOD != 0 else MOD
new_L = L % MOD
new_R = new_L + diff
# print("diff:{}, new_L:{}, new_R:{}".format(diff, new_L, new_R))

ans = L*R%MOD
for i in range(new_L, new_R):
    for j  in range(i+1, new_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())
A=[]
if R-L>=2019:
    print(0)
else:
    for i in range(L,R+1):
        A.append(i%2019)
    A=sorted(A)
    print(A[0]*A[1]%2019)
L,R = map(int,input().split())
L %= 2019
R %= 2019
R += 2019

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

l %= 2019
r %= 2019

L = min(l,r)
R = max(l,r)

a = 2019
# print(L,R)
for i in range(L,R+1):
    for j in range(i+1,R+1):
        a = min(a,(i*j)%2019)
if r-a > 2018:
    a= 0

print(a)
#!/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: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()
import sys 
L,R = map(int, input().split())

if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L == 1:
    print((R*L)%2019)
    sys.exit()

ans = 4000

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

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

mod = 2019

lm = l % mod
rm = r % mod

ans = []
if r - l >= mod :
  print(0)
  exit()
else:
  for i in range(lm,rm):
    for j in range(i+1,rm+1):
      ans.append(i*j)
  print(min(ans))
L, R = map(int, input().split())
MOD = 2019
if R - L + 1 >= 2019:
    print(0)
else:
    l_mod = L % 2019
    r_mod = R % 2019
    if r_mod < l_mod:
        print(0)
    else:
        min = l_mod * (l_mod + 1)
        for i in range(l_mod, r_mod):
            for j in range(i + 1, r_mod + 1):
                if (i * j) < min:
                    min = (i * j)
        print(min)
l, r = map(int, input().split())
n = l-r+1
ans1 = 0
ans2 = 0
min1 = 1000000000
min2 = 10000000000


for i in range(min(n, 2024)):
    if (l+i) % 2019 == 0:
        print(0)
        break
else:
    print((l*(l+1)) % 2019)
import sys
l,r=map(int,input().split())
if l+2019<=r:
  print(0)
  sys.exit()
mn=r-l
for i in range(l,r):
  mn=min(mn,i%2019)
if r%2019:
  print(mn*(mn+1))
else:print(0)
L, R = map(int, input().split())

if L//2019 == R//2019:
  num = float("inf")
  for i in range(L%2019, R%2019):
    for j in range(i+1, R%2019+1):
      if num >= (i*j)%2019:
        num = (i*j)%2019
  print(num)
else:
  num = float("inf")
  for i in range(L%2019, 2017):
    for j in range(i+1, 2018):
      if num >= (i*j)%2019:
        num = (i*j)%2019
  print(num)
L,R = map(int,input().split())

d = 10 ** 10

if R -L > 2019:
  print(0)
else:
  N = R -L 
  for i in range(N):
    for j in range(N):
      
      a = L+i
      b = L+j
      
      c = a * b % 2019
      d = min(c,d)
  print(d)
def main():
    l, r = map(int, input().split())
    
    a = l % 2019
    b = r % 2019
    if a >= b or r - l >= 2019:
        print(0)
    else:
        c = []
        for i in range(l, r+1):
            c.append(i % 2019)
        if 3 in c and 673 in c:
            print(0)
        else:
            print(c[0] * c[1])
        
    
if __name__ == '__main__':
    main()
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    l, r = map(int, input().split())
    ans = float("inf")
    if r - l >= 2019:
        ans = 0
    else:
        for i in range(l, r):
            ans = min((i*(i+1) % 2019), ans)
    print(ans)


if __name__ == "__main__":
    main()
l,r = list(map(int,input().split()))

l %= 2019
r %= 2019

L = min(l,r)
R = max(l,r)

a = 2019
# print(L,R)
for i in range(L,R+1):
    for j in range(i+1,R+1):
        a = min(a,(i*j)%2019)
        if a == 0:
            print(0)
            exit()
print(a)
L,R = map(int,input().split())
l = []
if R < L+2019:
    for i in range(L,R+1):
        l.append(i%2019)
else:
    for i in range(L,L+2019):
        l.append(i%2019)

print (l[0]*l[1])
L,R=map(int,input().split())
if L>=2019:
    L=L%2019
print(L*(L+1))
def resolve():
    '''
    code here
    '''
    L, R = [int(item) for item in input().split()]
    aL, bL = divmod(L, 2019)
    aR, bR = divmod(R, 2019)

    if bL == 0:
        res = 0
    elif aL < aR:
        res = 0
    elif aL == aR:
        res = bL*(bL+1)
    
    print(res)

if __name__ == "__main__":
    resolve()
#!/usr/bin/env python3
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
if R - L < 2019 and r > l and (r< 673 or l>3):
    print(min(i*(i+1)for i in range(l,r)))
else:
    print(0)
L, R = map(int, input().split())
L %= 2019
R = R % 2019 if R - L < 2019 else R % 2019 + 2019
# print(L, R)
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)
L, R = map(int, input().split())
A = [None]*2019
for i in range(L,R+1):
  if A[i%2019] is not None:
    break
  else:
    A[i%2019] = i%2019
A = list(filter(lambda x: x is not None,A))
print(A[0]*A[1])
def LI():
    return list(map(int, input().split()))


L, R = LI()
ans = 2020
for i in range(L, R+1):
    x = (i*i) % 2019
    for j in range(i, R+1):
        y = (i*j) % 2019
        ans = min(ans, y)
        if ans == 0:
            break
print(ans)
l, r = map(int, input().split())
if r - l + 1 >= 2019:
    print(0)
else:
    a = list("")
    for i in range(r - l + 1):
        a.append((i + l) % 2019)
    a.sort()
    print(a[0] * a[1])
L, R = map(int, input().split())
ml = L // 2019
mr = R // 2019

for i in range(ml, mr+1):
  print(i)
  if L <= 2019 * i <= R:
    print(0)
    exit()

L %= 2019
R %= 2019
ans = float('inf')
if L > R:
  L, R = R, L
elif L == R:
  R += 2019
if L == 0 or R == 0:
  print(0)
  exit()

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())
a = sorted(set(list([l%2019,(l+1)%2019,r%2019,(r-1)%2019])))
print(a[0]*a[1])
L, R = map(int, input().split())
if R - L >= 2019:
    print(0)
else:
    lis = list(range(L, R + 1))
    lis = sorted([i % 2019 for i in lis])
    print((lis[0] * lis[1]) % 2019)
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

l,r=input2()

left=l%2019
right=r%2019
if (left==0)  or (right==0):
	print(0)
elif right<left:
	print(0)
else:
	print(left*(left+1))
import math
L, R = list(map(int, input().split()))
if math.ceil(L / 2019) <= R // 2019:
    print(0)
else:
    print((L % 2019) * ((L + 1) % 2019) % 2019)
L, R = map(int, input().split())

MOD = 2019
L = L%MOD
R = R%MOD
if L > R:
    L, R = R, L

MIN = 2018
if L == R:
    MIN = 0
for i in range(L, R):
    for j in range(i+1, R+1):
        buf = (i*j) % MOD
        #print(i, j)
        MIN = min(buf, MIN)

print(MIN)
l,r=map(int,input().split())
mod=2019
ans=2020
if r-l>=mod:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans=min(((i%mod)*(j%mod)),ans)
    print(ans)
l, r = [int(i) for i in input().split()]
ln = l // 2019
rn = r // 2019
if ln == rn and l < r:
	l = l % 2019
	print (l * (l + 1))
else:
	print (0)
import sys
L, R = map(int, input().split())
if R-L > 2017: print(0); sys.exit()

DL = L % 2019
DR = R % 2019
if DL > DR: print(0); sys.exit()

print(DL*(DL+1)%2019)
l, r = map(int, input().split())

min = 4* (10**18)

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

        if min == 0:
            print("0")
            exit()

print(min)
url = "https://atcoder.jp//contests/abc133/tasks/abc133_c"

def main():
    t = list(map(int, input().split()))
    ans = []
    for i in range(t[0], t[1]+1):
        for j in range(i+1, t[1]+1):
            val = (i*j) % 2019
            if val == 0:
                print(val)
                break
            ans.append(val)
    print(min(ans))


if __name__ == '__main__':
    main()
L,R=map(int,input().split())
ans=100100100
for i in range(R-L,R):
  for j in range(i+1,R+1):
    if ans>((i*j)%2019):
      ans=((i*j)%2019)
print(ans)
MOD = 2019
L, R = map(int, input().split())
L, R = min(L%MOD,R%MOD), max(L%MOD,R%MOD)
ans = float('inf')
for i in range(L,R):
    for j in range(i+1,R+1):
        ans = min(ans,(i*j)%MOD)
print(ans)
L, R = map(int, input().split())
if R - L >= 2018:
    print(0)
elif L % 2019 >= R % 2019:
    print(0)
else:
    print(((L % 2019) * (L % 2019 + 1)) % 2019)
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    L, R = map(int, readline().split())

    if R - L > 10000:
        print(0)
    else:
        A = [i % 2019 for i in range(L, R + 1)]
        A.sort()
        print((A[0] * A[1]) % 2019)

    return


if __name__ == '__main__':
    main()
l,r=map(int,input().split())
l=l%2019
r=r%2019
if r<l:
  print(0)
  exit()
L=[]
for i in range(l,r+1):
  for k in range(i+1,r+1):
    L.append((i*k)%2019)
print(min(L))
if __name__ == '__main__':
    l, r = map(int, input().split())
    tmp = []
    for i in range(l, min(r + 1, l + 4029)):
        print(i)
        tmp.append(i % 2019)
    tmp.sort()
    print(tmp[0] * tmp[1] % 2019)
l,r = map(int,input().split())
if r-l >= 2018:
    print(0)
elif (l%2019 > r%2019) or (l%2019 == 0) or (r%2019 == 0):
    print(0)
else:
    r = l + 1
    r = r%2019
    l = l%2019
    print((r*l)%2019)
l,r = map(int,input().split())
if r-l>=2019:
  print(0)
else:
  cnt = 0
  tf = 0
  temp = 0
  while temp<r:
    temp = 2019*cnt
    cnt += 1
    if l<=temp<=r:
      tf = 1
  if tf:
    print(0)
  else:
    print((l%2019)*((l+1)%2019)%2019)
i, j = map(int, input().split())
a = i%2019
a_r = i//2019

b = j%2019
b_r = j//2019

if a_r == b_r:
  print(a*(a+1))
elif b_r > a_r or b<=a:
  print(0)
MOD = 2019
L,R=map(int,input().split())
l = L % MOD
r = R % MOD

ans = 2019**2
if l < r :
    for i in range(l,r+1):
        for j in range(i+1,r+1):
             ans = min(ans,i*j%MOD)
elif l >= r :
    s = list(range(l,2020))+list(range(1,r+1))
    for i in s:
        for j in s:
            if i ==j :
                break
            else:
                ans = min(ans,i*j%MOD)
print(ans)
import numpy as np

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

if R-L>=2019:
    print(0)
else:
    range_L_R = np.array(list(range(L, R+1)))
    range_L_R = range_L_R % 2019
    if ((R>=673) and (L<=672)) or ((R>=675) and (L<=673)) or 0 in range_L_R:
        print(0)
    else:
        print(L*(L+1) % 2019)
a,b=map(int,input().split())
c=[]
for i in range(a,b+1):
    for j in range(a,i):
        c.append(i*j%2019)

c=list(set(c))
for i in range(len(c)):
    min=i
    for j in range(i+1,len(c)):
        if c[i]>c[j]:
            min=j
    c[i],c[min]=c[min],c[i]

print(c[0])
l,r = map(int, input().split())
if (r-l >= 2018):
    print(0)
    exit()
a = []
for i in range(l,r+1):
    a.append(i%2019)
a.sort()
print(a[0]*a[1])
L, R = [int(i) for i in input().split()]
R = min(R, L + 4038)
ans = 2018
for i in range(L, R):
    for j in range(i + 1, R):
        x = (i * j) % 2019
        ans = min(ans, x)
print(ans)
x,y=list(map(int, input().split()))

if y>x+2020:
	y=x+2020

ans=2019
for i in range (x,y+1):
	for j in range (x+1,y+1):
		if (i*j)%2019<ans:
			ans=(i*j)%2019
print(ans)
l,r = map(int,input().split())
a = l%2019
b = r-l
if a+b >= 2019:
    print(0)
else:
    print(l*(l+1)%2019)
L, R = map(int,input().split())
a = L % 2019
b = R % 2019
if a > b:
    print(0)
else:
    print((a*(a+1))%2019)
L, R = map(int, input().split())
if R - L >= 673:
    print(0)
elif R - L == 1:
    print((R*L)%2019)
else:
    L %= 2019
    R %= 2019
    if L > R:
        print(0)
    else:
        ans = (L*(L+1))%2019
        for l in range(L, R):
            for r in range(l+1, R+1):
                val = (l*r)%2019
            ans = min(ans, val)
        print(ans)
L,R = map(int,input().split())
mod = 2019
print((L*(L+1))%2019)
def solve():
    N, M = map(int, input().split())
    if M-N >= 2018:
        return 0
    a = N % 2019
    b = N % 2019
    c = min(a, b)
    return (c * (c+1)) % 2019

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

# mod2019 = 0を２つ以上含むなら答えは０
if R - L > 2019*3:
    print(0)
    exit()

# それ以外の時は，小さいのを２個取り出してかけて出力
# じゃダメで，３, 673,という訳すを持つ

mod_list = []
for i in range(L,R+1):
    mod_list.append(i % 2019)

if 673 in mod_list and (672 in mod_list or 675 in mod_list):
    print(0)

print((mod_list[0] * mod_list[1]) % 2019)
l, r = map(int, input().split())

rem_l = l%2019
rem_r = r%2019

ans = -1

if r - l >= 2019:
    ans = 0

elif rem_l >= rem_r:
    ans = 0

else:
    ans = rem_l * (rem_l + 1)
    ans %= 2019

print(ans)
# 初期入力
import sys
input = sys.stdin.readline
L,R = (int(x) for x in input().split())

mod_L =L %2019
mod_R =R %2019
ans =0
if 2019 <= R -L:
    ans =0
elif mod_R < mod_L:
    ans =0
else:
    a =min(mod_L,mod_R)
    ans =a *(a +1)
print(ans)
l, r = [int(i) for i in input().split()]
mn = [2019, 2019]
for i in range(l, r + 1):
    t = i % 2019
    if mn[0] > t: mn[0] = t
    elif mn[1] > t: mn[1] = t 
print((mn[0] * mn[1]) % 2019)
L, R = map(int, input().split())
ans = []
if R - L >= 2019:
  print(0)
else:
  for i in range(L, R+1):
    ans.append(i%2019)
  print(min(ans)*(min(ans)+1))
L, R = map(int, input().split())
length = R - L + 1
if length >= 673:
    print(0)
else:
    l = L % 2019
    if l + length > 673:
        if length >= 3:
            print(0)
        elif l == 672:
            print(0)
        else:
            print(L*(L+1)%2019)
    else:
        print(L*(L+1)%2019)
a, b = map(int, input().split())

A = []

for i in range(a, min(a+4000, b+1)):
    A.append(i%2019)

# print(A[0] * A[1])
A = sorted(A)

if (b - a + 1) >= 673:
    print(0)
else:
    print(A[0] * A[1])
L,R=map(int,input().split())
n=2019
L%=n
R%=n
ans=L*R%n
for i in range(L,R+1):
    for j in range(i+1,R+1):
        ans=min(ans,i*j%n)
print(ans)
L, R = map(int, input().split())

ind_s = L
ind_e = min(L + 2019, R)

choices_mod = [x%2019 for x in range(ind_s, ind_e+1)]
choices_mod_sort = sorted(choices_mod)

if len(choices_mod_sort) >= 2:
    print((choices_mod_sort[0]*choices_mod_sort[1])%2019)
else:
    print(choices_mod_sort[0])
l, r = map(int, input().split())

ans = float('inf')
for i in range(l, r):
    for j in range(i + 1, r + 1):
        x = i * j % 2019
        if x == 0:
            break
        ans = min(ans, x)
        
print(ans)
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
    exit()
data = set()
if r < l:
    for i in range(l%2019, 2020):
        data.add(i)
    for i in range(r%2019+1):
        data.add(i)
else:
    for i in range(l%2019, r%2019+1):
        data.add(i)
ans = float('inf')
for j in data:
    for k in data:
        if j == k:
            continue
        else:
            ans = min(ans, j*k)

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

if R - L >= 2019:
    print(0)
    
else:
    lis = []
    for i in range(L, R+1):
        lis.append(i%2019)
    lis = sorted(lis)
    print(lis[0]*lis[1])
l, r = map(int, input().split())
rem = []
mod = 2019
if r - l + 1 >= 2019:
    ans = 0
else:
    for i in range(l, r+1):
        rem.append(i % mod)
    rem.sort()
    ans = rem[0]*rem[1]

print(ans)
L,R=map(int,input().split())
ans=2018
if R-L>=673:
  print(0)
  exit()
for i in range(R-L+1):
  for j in range(1,R-L+2):
    if ans>((L+i)*(L+j))%2019:
      ans=((L+i)*(L+j))%2019
print(ans)
L,R = map(int,input().split())

x = (R - L)%2019
L %= 2019
R = L + x

#print(L,R)

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

if L == 0 or R == 0:
  m = 0

print(m)
L, R = map(int,input().split())
l = L%2019
r = R%2019
if R-L >= 2018:
  print(2)
elif l >= r:
  print(2)
else:
  print(l*(l+1))
L,R = map(int, input().split(" "))
w = R-L
List = [int(i)%2019 for i in range(L,R+1)]

if w>2019:
    print(0)
else:
    Min = 2018
    for i in range(len(List)-1):
        for j in range(i+1,len(List)):
            l = List[j]*List[i]
            if l<Min:
                Min = l
    print(Min)
l,r=map(int,input().split())
i=1
temp=0
while r>2019*i:
  if l<=2019*i:
    temp=1
    break
  i=i+1

temp1=1
if r==l+1:
  if l%3!=0 and r%3!=0:
    temp1=0
  
i=1
temp2=0
while r>673*i:
  if l<=673*i:
    temp2=1
    break
  i=i+1

if temp==1:
  print(0)
elif temp1==1 and temp2==1:
  print(0)
else:
  print(((l*(l+1))%2019))
l, r = map(int, input().split())

ans = divmod(l*r, 2019)[1]
for i in range(l+1, r+1):
  q, mod = divmod(l*i, 2019)
  ans = min(ans, mod)

print(ans)
r,l = map(int,input().split())
if l-r+1 >= 2019:
    print("0")
    exit()
li = []
for i in range(l-r+1):
    li.append((r+i)%2019)
li.sort()
lia = []
for i in range(len(li)):
    for j in range(len(li)):
        lia.append((li[i]*li[j])%2019)
print(min(lia))
M = 2019

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

if R-L >= M or L%M >= R%M:
    ans = 0
else:
    ans = M
    L, R = L%M, R%M
    for i in range(L, R+1):
        for j in range(L+1, R+1):
            ans = min(ans, (i*j)%M)

print(ans)
L,R = map(int,input().split())
if L==R:
  print(L%2019 * L%2019)
  exit()

l = L%2019
r = R%2019

if l < r:
  if l <= 3 and r >= 673:
    print(0)
  else:
    print((L*(L+1)%2019))
else:
  print(0)
l, r = map(int, input().split())

if l == 0 or (l-1)//2019 != r//2019 or ((l-1)//3 != r//3 and (l-1)//673 != r//673):
	print(0)
else:
	print((((l%2019)*((l+1)%2019))%2019)%2019)
L, R = map(int, input().split())
i = 2017
j = 2018
i_mod = 2017
j_mod = 2018

for n in range(L, R + 1):
    n_mod = n % 2019
    if n_mod < i_mod:
        i, j = n, i
        i_mod = n_mod
    elif n_mod < j_mod:
        j = n
        j_mod = n_mod

print((i * j) % 2019)
l, r = map(int, input().split())
ans = 2020
for i in range(1, min(r-l+1, r+2019)):
    x = (l * (l + i)) % 2019
    ans = min(x, ans)
print(ans)
l,r=map(int,input().split())
x=[]
if (r-l)>=2019:
    print(0)
else:
    for i in range(l,r+1):
        x.append(i%2019)
    x.sort()
    print(min((x[0]*x[1])%2019,(x[r-l]*x[r-l-1]%2019)))
a,b=[int(i) for i in input().split()]
c=a*(a+1)
print(c%2019)
L, R = map(int, input().split())

ans = 2018
if R - L >= 2019:
  print(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 = 10**18

for i,j in zip(range(L,R),range(L+1,R+1)):
    m = min(m,i%2019*j%2019)
print(m)
L, R = map(int, input().split())
div = 2019

ans = 0

if L == 0:
  ans = 0
elif L//div < R//div:
  ans = 0
else:
  ans = L%div * (L+1)%div

print(ans)
l, r = map(int, input().split())
r = 2018
ll = min(l+2019, r)+1
for i in range(l, ll):
    for j in range(i+1, ll):
        r = min(r, i*j%2019)
        if r == 0:
            break
print(r)
L,R=map(int,input().split())
l=L%2019
r=R%2019
l1=L//2019
r1=R//2019
if l1<r1:
  print(0)
  exit()
print((l*(l+1))%2019)
a,b=map(int,input().split())
mindiv=1000000000
for i in range(a,b):
  for j in range(i,b+1):
    if i%2019==0 or j%2019==0:
      print(0)
      exit()
    else:
      mindiv=min(i*j%2019,mindiv)
print(mindiv)
l,r=map(int,input().split())
arr=[]
for i in range(l,r+1):
    arr.append(i%2019)
    if i==l+2019:
        break

arr.sort()
#print(arr)
print(arr[0]*arr[1])
L, R = map(int, input().split())
mod = 2019
ans = mod + 100
if R - L >= 3000:
    print(0)
else:
    for i in range(L,R):
        for j in range(i + 1, R + 1):
            m = (i*j) % mod
            if m < ans:
                ans = m
print(ans)
l, r = map(int, input().split())
dif = r - l
ans = 0
if dif >= 2019:
    ans = 0
else:
    mod_l = l % 2019
    mod_r = r % 2019
    if mod_l < mod_r:
        ans = mod_l * (mod_l + 1)
    else:
        ans = 0
print(ans%2019)
l, r = map(int, input().split())
if l-r+1 >= 2019:
    print(0)
else:
    l %= 2019
    r %= 2019
    if l <= r:
        ans = float('inf')
        for i in range(l, r):
            for j in range(i+1, r+1):
                ans = min(ans, (i*j)%2019)
    else:
        ans = 0
    print(ans)
L, R = list(map(int, input().split()))
l = L%2019
r = R%2019
ans = 2020
if abs(L-R)>=2019:
    print(0)
else:
    for i in range(L, R):
        ans = min(ans, (i*(i+1))%2019)

print(ans)
l,r = map(int,input().split())
remainder_lst = []

for i in range(l,r+1):
    remainder_lst.append(i%2019)

remainder_lst.sort()
minimum = remainder_lst[0]*remainder_lst[1]%2019

print(minimum)
l,r = map(int,input().split())
mod = 2019
min_2019 = min(2019,r-l)
min = 10**9
c = 0
for i in range(l,r):
    c += 1
    if c == 2020:
        break
    j = i+1
    if (i*j)%mod < min:
        min = (i*j)%mod
    
    if min == 0:
        break
        

print(min)
# -*- coding: utf-8 -*-
l, r = map(int,input().split()) 

ans = 2018
for i in range(l, l + 2020):
    for j in range(i + 1, min(r + 1, i + 2021)):
        if (i % 2019) * (j % 2019) < ans:
            ans = (i % 2019) * (j % 2019)
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:
    d=d[a:b+1]
else:
    d=d[b:a+1]
    
ans=10**9
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())
ll=l%2019
rr=r%2019
if  l//2019==r//2019:
    print((ll*(ll+1))%2019)
else:
    print(0)
l, r = map(int, input().split())
n = r-l+1
ans1 = 0
ans2 = 0
min1 = 1000000000
min2 = 10000000000


for i in range(min(n, 2024)):
   # print(l+i)
    if (l+i) % 2019 == 0:
        print(0)
        break
else:
    ans = 10000000000
    for i in range(min(n, 2019)):
        for j in range(i+1, min(n, 2020)):
            if ((l+i)*(r+j)) % 2019 < ans:
                ans = ((l+i)*(r+j)) % 2019
                # print(ans, l+i, r+j)
    print(ans)
# 初期入力
import sys
input = sys.stdin.readline
L,R = (int(x) for x in input().split())

mod_L =L %2019
mod_R =R %2019
ans =0
xx=[]
if 2019 <= R -L:
    ans =0
elif mod_R < mod_L:
    ans =0
elif mod_L==0 :
    ans =0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            x =(i %2019) * (j%2019)
            xx.append(x)
    ans =min(xx)
print(ans)