Problem:
 Score : 300 points    Problem Statement You are given two non-negative integers L and R .
We will choose two integers i and j such that L \leq i < j \leq R .
Find the minimum possible value of (i \times j) \mbox{ mod } 2019 .      Constraints  All values in input are integers.  0 \leq L < R \leq 2 \times 10^9         Input Input is given from Standard Input in the following format:  L  R       Output Print the minimum possible value of (i \times j) \mbox{ mod } 2019 when i and j are chosen under the given condition.        Sample Input 1 2020 2040      Sample Output 1 2  When (i, j) = (2020, 2021) , (i \times j) \mbox{ mod } 2019  = 2 .       Sample Input 2 4 5      Sample Output 2 20  We have only one choice: (i, j) = (4, 5) .

Solution (Python):
L, R = map(int, input().split())
ans = 2018
for i in range(L, min(R, L+2019)+1):
    for j in range(i+1, min(R, i+2019)+1):
        ans = min(ans, i*j%2019)
print(ans)

Solution (Python):
l, r = map(int, input().split())

minVal = -1
for i in range(l, r):
    for j in range(i+1, r+1):
        modVal = (i * j) % 2019
        if minVal == -1 or minVal > modVal:
            minVal = modVal
            if minVal == 0:
                break
    if minVal == 0:
        break
print(minVal)

Solution (Python):
def prob_c():
    l, r = [int(a) for a in input().split()]
    if r - l >= 2018:
        print("0")
    else:
        l = l % 2019
        r = r % 2019
        ans = 2018
        for i in range(l, r):
            for j in range(i+1, r+1):
                candidate = (i * j) % 2019
                if ans > candidate:
                    ans = candidate
            if ans == 0:
                break
        print(str(ans))

prob_c()

Solution (Python):
def solve():
    l, r = map(int, input().split())
    ans = 2018
    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)
solve()

Solution (Python):
L, R = map(int, input().split())

mod = 2018

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

print(mod)

Solution (Python):
l, r = map(int, input().split())
r_ = min(r, l + 2019) + 1
min_score = 2019
for i in range(l, r_):
    for j in range(i + 1, r_):
        score = (i * j) % 2019
        min_score = min(min_score, score)
print(min_score)

Solution (Python):
l,r=map(int,input().split())
mod=2019
if r-l>=2019:
    print(0)
    exit()
else:
    x=[]
    for i in range(l,r):
        for j in range(i+1,r+1):
            x.append(((i%mod)*(j%mod))%mod)
    print(min(x))

Solution (Python):
L, R = map(int, input().split())
ans = 10**100
for i in range(L, min(R, L+2019)):
    for j in range(i+1, min(R+1, L+2019)):
        ans = min(ans, (i*j) % 2019)
print(ans)

Solution (Python):
l,r = map(int,raw_input().split())

if r-l >= 2019:
	best = 0
else:
	lm = l%2019
	rm = r%2019
	if r > l:
		a = range(lm,rm+1)
		best = 2019
		for i in xrange(len(a)-1):
			for j in xrange(i+1,len(a)):
				temp = (a[i]*a[j])%2019
				if temp < best:
					best = temp
	else:
		best = 0
print best

Solution (Python):
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)

Solution (Python):
l,r = map(int, input().split())

if l//2019 != r//2019 or l%2019 == 0 or r%2019 == 0:
    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)

Solution (Python):
L, R = map(int, input().split())



def f():
    if L % 2019 == 0 or R % 1029 == 0:
        return 0

    p_L = L // 2019
    p_R = R // 2019
    if p_L != p_R:
        return 0
    
    S = [(i * j) % 2019 for i in range(L, R) for j in range(i + 1, R + 1)]
    return min(S)

print(f())

Solution (Python):
L,R = map(int,input().split())

ans = float('inf')

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

print(ans)

Solution (Python):
L, R= list(map(int,input().split()))

if R - L >= 2018:
    print(0)
    exit()

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

print(ans)

Solution (Python):
L,R=map(int,input().split())
a=(L-1)//2019
if (a+1)*2019<=R:
    print(0)
else:
    a=L%2019
    b=R%2019
    print(min([(i*j)%2019 for i in range(a,b+1) for j in range(i+1,b+1)]))

Solution (Python):
import math
l,r = list(map(int, input().split()))

mi = 9999
for i in range(min(r-l+1,2019)):
    ll = l+i
    for j in range(min(r-l+1,2019)):
        if(i<=j):
            continue
        rr = l+j
        mi = min((ll*rr)%2019,mi)
print(mi)

Solution (Python):
L, R = map(int, input().split())

if R-L >= 2019:
    print(0)
else:
    L, R = L%2019, R%2019
    if L > R:
        R += 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)

Solution (Python):
L,R = list(map(int, input().split()))

if R-L >= 2018:
  print(0)
  exit(0)
  
L = L%2019
R = R%2019

if L > R:
  print(0)
  exit(0)
  
ans = 3000
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)
      exit(0)
    
print(ans)

Solution (Python):
L, R = map(int, input().split())

ans = 10**8

if R-L>=2019:
    ans = 0
else:
    for l in range(L, R):
        for r in range(l+1,R+1):
            ans = min(ans, (l%2019)*(r%2019)%2019)
        
print(ans)

Solution (Python):
L,R = map(int,input().split())

ans = 2019*2019

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

Solution (Python):
l,r=map(int,input().split())
if l//2019 < r//2019:
    print(0)
else:
    l%=2019
    r%=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)

Solution (Python):
l, r = (int(_) for _ in input().split())

if r-l>=2019:
    kotae=0
else:
    a=l%2019
    b=r%2019
    if a>b:
        kotae=0
    else:
        kotae=2019
        for i in range(b-a):
            sho=a+i
            for j in range(b-a-i):
                dai=a+j+i+1
                
                koho=(sho*dai)%2019
                if koho<kotae:
                    kotae=koho

print(kotae)

Solution (Python):
import sys
L,R=map(int,input().split())
mod=2019
q,r=L//mod,L%mod
q1,r1=R//mod,R%mod

if r==0 or r1==0 or q<q1:
    print(0)
    sys.exit()
mi=10**9
for i in range(r,r1):
    for j in range(i+1,r1+1):
        
        mi=min(mi,(i*j)%mod)
print(mi)

Solution (Python):
L,R = map(int,input().split())
if R-L >= 2019:
    modL = 0
    modR = 2018
else:
    l = L%2019
    r = R%2019
    if r>l:
        modR = r
        modL = l
    else:
        modL = r
        modR = l+2019

ans = 100000000
for x in range(modL+1,modR+1):
    for y in range(modL,x):
        ans = min(ans,(x*y)%2019)
print(ans)

Solution (Python):

from itertools import combinations

l, r = [int(x) for x in input().split()]

if r - l >= 2019:
    l = r = 0

l %= 2019
r %= 2019
if l >= r:
    r += 2019

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

Solution (Python):
import numpy as np

L,R  = list(map(lambda x: int(x),input().split()))
ans=2019
for i in range(2019):
    for j in range(2019):
        l = L+i
        r = R-j
        if l>=r :
            continue
        candidate = (l*r)%2019
        if ans>candidate:
            ans=candidate
print(ans)

Solution (Python):
import sys
l,r = map(int, input().split())
if r-l >= 2019:
    print(0)
    sys.exit()
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)

Solution (Python):
L,R=(int(x) for x in input().split())

def Solve():
    if R-L>=672: 
        return 0
    
    result=2*10**9
    for i in range(L,R+1):
        for j in range(L,R+1):
            if j==i:
                continue
            result=min(result,(j*i)%2019)

    return result
    
print(Solve())

Solution (Python):
def acinput():
    return list(map(int,input().split(" ")))


L,R=acinput()

minv=10**5
for i in range(L,min(R+1,L+2019)):
    for j in range(i+1,min(R+1,L+2019)):
        tmp=(i*j)%2019
        
        if minv>tmp:
            minv=tmp
    
print(minv)

Solution (Python):
L,R=map(int,input().split())
if R-L>2017:
    print(0)
    quit()
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)

Solution (Python):
l, r = list(map(int, input().split()))
mod = 2019

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

l = l % mod
r = r % mod
if r < l:
	r += mod 

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

print(ans)

Solution (Python):
def solve(L, R):
    if R - L >= 2019:
        return 0

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

if __name__ == "__main__":
    L, R = map(int, input().split(" "))
    print(solve(L, R))

Solution (Python):
L, R = map(int, input().split())
if L // 2019 < R // 2019:
    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)

Solution (Python):



def solve():
    l, r = map(int, input().split())
    if r - l >= 2019:
        print(0)
        return
    ans = 2019
    for i in range(l, r + 1):
        for j in range(l, r + 1):
            if i == j:
                continue
            ans = min(ans, (i * j) % 2019)
        if ans == 0:
            break
    print(ans)

if __name__=="__main__":
    solve()

Solution (Python):
l,r = map(int, input().split())

ans = float('inf')
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)

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

Solution (Python):
l,r=map(int,input().split())
ans=3000
if r-l<673:
    for i in range(l+1,r+1):
        for j in range(l,i):
            ans=min(ans,i*j%2019)
else:
    ans=0
print(ans)

Solution (Python):
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]






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

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

Solution (Python):
l,r=map(int,input().split())
if r-l>2018:
    print("0")
    exit()
ans=2018
for i in range(l,r):
    for j in range(i+1,r+1):
        ans=min(ans,(j*i)%2019)
print(ans)

Solution (Python):
L,R = map(int,input().split())
mod_list = []
if R-L >= 2019:
	mod_list = [i for i in range(2020)]
else:
	for i in range(L,R+1):
		mod_list.append(i%2019)
mod_list.sort()
ans = (mod_list[0]*mod_list[1]) % 2019
len_modlist = len(mod_list)
for i in range(len_modlist-1):
	for j in range(i+1, len_modlist):
		tmp = (mod_list[i] * mod_list[j]) % 2019
		ans = min(ans, tmp)
print(ans)

Solution (Python):
L, R = map(int, input().split())
MOD = 2019

m = float('inf')
if L + MOD < R :
    for i in range(MOD) :
        for j in range(MOD) :
            m = min(m, i*j%MOD)
else :
    for i in range(L, R) :
        for j in range(i+1, R+1) :
            m = min(m, i*j%MOD)
            
print(m)

Solution (Python):
l, r = map(int, input().split())
d = r - l
d = min(d, 2019)
l %= 2019
r = l + d
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)

Solution (Python):
l, r = map(int, input().split())

l0 = l % 2019
l1 = l // 2019
r0 = r % 2019
r1 = r // 2019

if l1 != r1:
    res = 0
else:
    amari = 2019
    for i in range(l0, r0+1):
        for j in range(i+1, r0+1):
            amari = min(amari, (i * j) % 2019)

    res = amari

print(res)

Solution (Python):
l, r = list(map(int, input().split()))
ans = 1e20
for i in range(l, min(r, l+2020)):
  for j in range(i+1, min(r+1, i+1+2020)):
    ans = min(ans, (i%2019)*(j%2019)%2019)
print(ans)

Solution (Python):
L, R = map(int, input().split())

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

Solution (Python):
L, R = [int(elem) for elem in input().split()]
diff = R - L + 1
if L == 0 or diff >= 2019:
    print(0)
    exit(0)

min_rem = 2018
for i in range(L, R):
    for j in range(i + 1, R + 1):
        rem = (i * j) % 2019
        min_rem = min(rem, min_rem)
print(min_rem)

Solution (Python):
l,r=map(int,input().split())

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

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

Solution (Python):
L,R = (int(x) for x in input().split())

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

print(min_val)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    n, a, b = LI()
    print(min(n * a, b))
    return


def B():
    n, d = LI()
    x = LIR(n)
    a = list(itertools.combinations(range(n), 2))
    ans = 0
    for a1,a2 in a:
        b = 0
        for bi in range(d):
            b += (x[a1][bi] - x[a2][bi])** 2
        if float.is_integer(math.sqrt(b)):
            ans += 1
    print(ans)
    return


def C():
    l, r = LI()
    ans = 2018
    if l // 2019 == r // 2019:
        for i in range(l, r + 1):
            for k in range(i+1, r + 1):
                ans = min(ans, (i * k) % 2019)
        print(ans)
    else:
        print(0)
    return


def D():
    n = II()
    a = LI()
    
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    C()

Solution (Python):
import numpy as np
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 
N = 10**4
g1 = [1, 1] 
g2 = [1, 1] 
inverse = [0, 1] 

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


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

if r-l >= 2018:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            sup = (i*j)%2019
            if sup < ans:
                ans = sup

    print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

L, R = MAP()
if R-L+1 >= 2019:
	print(0)
else:
	ans = 10000
	for i in range(L, R+1):
		for j in range(i+1, R+1):
			ans = min(ans, (i*j)%2019)
	print(ans)

Solution (Python):
L, R = map(int, input().split())

mi = 10**20
for i in range(L, min(R, L+2030)):
    for j in range(i+1, min(R+1, i+2030)):
        mi = min(mi, i*j%2019)
print(mi)

Solution (Python):
import itertools
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

L, R = list(map(int, sys.stdin.readline().split()))

R = min(L + 2020, R)
ans = INF
for i, j in itertools.combinations(range(L, R + 1), r=2):
    ans = min(ans, (i * j) % 2019)

print(ans)

Solution (Python):
L,R = list(map(int,input().split()))

la=L//2019
ra=R//2019
lb=L%2019
rb=R%2019

if ra-la>=1:
    print(0)
else:
    ans = 2018
    for i in range(lb,rb):
        for j in range(i+1,rb+1):
            ans = min((i*j)%2019,ans)

    print(ans)

Solution (Python):
from functools import reduce
import math

MIN = -10 ** 9
MAX = 10 ** 9


def main():
    L, R = [int(a) for a in input().split()]

    if R - L > 2020:
        print(0)
        return

    r = 2 * (10 ** 9)
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            m = (i * j) % 2019
            if m < r:
                r = m
    print(r)


if __name__ == '__main__':
    main()

Solution (Python):
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
    exit()
res = float('inf')
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        res = min(res, (i * j) % 2019)
print(res)

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

mod = 2019
L,R = inpl()
Lm,Rm = L%mod, R%mod

if Lm < Rm and L//mod == R//mod:
    ans = INF
    for x in range(Lm,Rm+1):
        for y in range(x+1,Rm+1):
            ans = min(ans,x*y%mod)
    print(ans)
else:
    print(0)

Solution (Python):
l, r = map(int, input().split())

m = 2019 + 1
value = float("inf")
for i in range(l, min(r + 1, l + m * 2)):
    for j in range(i + 1, min(r + 1, i + m * 2)):
        value = min((i * j) % 2019, value)
print(value)

Solution (Python):
import sys,collections as cl,bisect as bs,math
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l(): 
	return list(map(int,input().split()))
def m(): 
	return map(int,input().split())
def onem(): 
	return int(input())
def s(x): 
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): 
	return " ".join(map(str,x))
def max2(x): 
	return max(map(max,x))

n,m = m()

mi = 2019

if m-n >= 2019:
	print(0)
	exit()
else:
	n %= 2019
	m %= 2019
	if n > m:
		print(0)
		exit()
	else:
		for i in range(n,m):
			for j in range(i+1,m+1):
				if (i * j) % 2019 <= mi:
					mi = (i * j) % 2019
print(mi)

Solution (Python):
L, R = map(int, input().split())

l_max = min(L + 2018, R-1)
r_min = max(R - 2018, L+1)
ans = float("inf")
for l in range(L, l_max+1):
    for r in range(r_min, R+1):
        if l >= r:
            continue
        ans = min(ans, l*r%2019)
print(ans)

Solution (Python):
L, R = map(int, input().split())

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

print(ans)

Solution (Python):
L,R = map(int,input().split())
if R-L+1 >= 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)

Solution (Python):
L,R = map(int,input().split())
MOD = 2019

ans = MOD
for l in range(L,L+MOD+2):
    for r in reversed(range(R-MOD-2,R+1)):
        if l>=r: break
        ans = min(ans, (l*r)%MOD)
print(ans)

Solution (Python):
def main():
	L, R = map(int, input().split())
	if R - L >= 2019:
		print(0)
		return
	L %= 2019
	R %= 2019
	if R < L:
		print(0)
		return
	ans = 2019
	for i in range(L+1, R+1):
		for j in range(L, i):
			ans = min(ans, i*j%2019)
	print(ans)


if __name__ == '__main__':
	main()

Solution (Python):
l, r = [int(i) for i in input().split()]

ans = 2019

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)

Solution (Python):
import sys

inf = 10 ** 18

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

if (L // 2019) < (R // 2019):
    print(0)
else:
    ans = inf
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans_tmp = (i * j) % 2019
            if ans > ans_tmp:
                ans = ans_tmp
    print(ans)

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    
    l, r = map(int, input().split())
    if r - l >= 2019:
        ans = 0
    else:
        ans = 100000
        for i in range(l, r):
            for j in range(i + 1, r + 1):
                ans = min(ans, i * j % 2019)
    
    print(ans)
    
    return 0

main()

Solution (Python):
def main():
    a, b = map(int, raw_input().split())
    if b - a >= 2019:
        print 0
        return
    best = 2018
    for i in xrange(a, b):
        for j in xrange(i + 1, b + 1):
            best = min(best, i * j % 2019)
    print best


if __name__ == '__main__':
    main()

Solution (Python):
l, r = map(int,input().split())

ans = 2019
for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = i*j % 2019
        if ans > tmp:
            ans = tmp
        if ans == 0:
            print(ans)
            exit(0)
print(ans)

Solution (Python):
L, R = map(int, input().split())
if R - L >= 2019:
    print(0)
    exit()

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)

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

l, r = getList()
if r >= l + 2019:
    r = l + 2018


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



print(ans)

Solution (Python):
def find(L,R):
    if R-L>=2019:
        return 0
    MIN=2019
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            MIN=min((i*j)%2019,MIN)
    return MIN
L,R=list(map(int,input().strip().split(' ')))
print(find(L,R))

Solution (Python):
L, R = list(map(int, input().split()))

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

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

print(ans)

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

if R>=L+2020:
    print(0)
else:
    D=list(range(L,R+1))

    L=len(D)

    ANS=1<<40

    for i in range(L-1):
        for j in range(i+1,L):
            ANS=min(ANS,D[i]*D[j]%mod)

    print(ANS)

Solution (Python):
l, r = map(int, raw_input().split())

r = min(r, l + 2019)
print min(i * j % 2019 for i in xrange(l, r + 1) for j in xrange(l, i))

Solution (Python):
def main():
    L, R = map(int, input().split())
    R = min(L+2019, R)
    ans = 2019
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min((i*j) % 2019, ans)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
L, R = map(int, input().split())
U = [0]*2019
for i in range(L, min(L+2019, R)+1):
    U[i % 2019] = 1
ans = 10**18
for i in range(2019):
    if not U[i]:
        continue
    for j in range(i+1, 2019):
        if not U[j]:
            continue
        ans = min(ans, (i*j) % 2019)
print(ans)

Solution (Python):


from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

L, R = map(int, raw_input().split())
if R / 2019 != L / 2019 or L % 2019 == 0:
    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

Solution (Python):

import sys
from operator import itemgetter

from fractions import gcd

from math import ceil, floor

from copy import deepcopy

from itertools import accumulate






from collections import Counter
import math
from functools import reduce
sys.setrecursionlimit(200000)

input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(x): print("debug: ", x, file=sys.stderr)







MOD = 2019  


def solve(L: int, R: int):
    if R > L + 2040:
        R = L + 2040
    ans = 10**9
    for i in range(L, R+1):
        for j in range(i+1, R + 1):
            ans = min(ans, i * j % 2019)
    print(ans)


def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


def main():
    tokens = iterate_tokens()
    L = int(next(tokens))  
    R = int(next(tokens))  
    solve(L, R)


if __name__ == '__main__':
    main()

Solution (Python):
l, r = map(int, input().split())
MOD = 2019

if r - l > 2019:
    print(0)
    exit()
    
ans = 2020
for i in range(l, r + 1):
    for j in range(l, r + 1):
        if i == j:
            continue
        ans = min(ans, (i * j) % MOD)
print(ans)

Solution (Python):
L, R = map(int, input().split())
num = float('inf')
for i in range(L, min(L + 2020, R + 1)):
    for j in range(i + 1, min(L + 2020, R + 1)):
        num = min(num, (i * j) % 2019)

print(num)

Solution (Python):
L, R = map(int, input().split())

ans = 10**10
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)

Solution (Python):
L, R = map(int, input().split())
U = [0]*2019
for i in range(L, min(L+2019, R)+1):
    U[i % 2019] = 1
ans = 10**18
for i in range(2019):
    if not U[i]:
        continue
    for j in range(i+1, 2019):
        if not U[j]:
            continue
        ans = min(ans, (i*j) % 2019)
print(ans)

Solution (Python):
L, R = map(int, raw_input().split())

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

Solution (Python):


import sys

class CRemainderMinimization2019:
    def solve(self):
        l, r = [int(_) for _ in input().split()]
        if r - l > 2019:
            print(0)
        else:
            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)

solver = CRemainderMinimization2019()
input = sys.stdin.readline

solver.solve()

Solution (Python):
l,r=map(int,input().split())
if r-l>=2019:
  print(0)
else:
  tmp=2019
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      tmp=min(tmp,(i*j)%2019)
  print(tmp)

Solution (Python):
l,r=map(int,input().split())
if r-l+1>=2019:
    print(0)
else:
    ans=2018
    for i in range(l,r):
        I=i%2019
        for j in range(i+1,r+1):
            J=j%2019
            ans=min(ans,I*J%2019)
    print(ans)

Solution (Python):
l,r=map(int,input().split())
mod=2019
lm=l%673
if r-l+1>=673:
    print(0)
else:
    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)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n,a,b = LI()
    print(min(a*n,b))
    return


def B():
    n,d = LI()
    x = LIR(n)
    f = defaultdict(lambda : 0)
    for i in range(1000000):
        f[i*i] = 1
    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            s = 0
            for k in range(d):
                s += (x[i][k]-x[j][k])**2
            if f[s]:
                ans += 1
    print(ans)
    return


def C():
    l,r = LI()
    if r-l > 2019:
        print(0)
        quit()
    ans = float("inf")
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            if i*j%2019 < ans:
                ans = i*j%2019
    print(ans)
    return


def D():
    n = I()

    return


def E():
    n = I()

    return


def F():
    n = I()

    return



if __name__ == "__main__":
    C()

Solution (Python):
l, r = map(int, input().split())
if r - l + 1 >= 2019:
    print(0)
else:
    ans = 5000
    for i in range(l, r):
        for j in range(l+1, r+1):
            ans = min(ans, i*j % 2019)
    print(ans)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
from functools import reduce
import sys
import math
import bisect
import random
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return list(map(float, sys.stdin.readline().split()))
def LS():return sys.stdin.readline().split()
def SR(n): return [list(sys.stdin.readline())[:-1] for i in range(n)]
def IR(n): return [int(sys.stdin.readline()) for i in range(n)]
def LIR(n): return [list(map(int, sys.stdin.readline().split())) for i in range(n)]
def LSR(n): return [list(map(list, sys.stdin.readline().split())) for i in range(n)]
_gcd = lambda x, y: _gcd(y, x%y) if (x%y) else y
_lcm = lambda x, y: x*y // _gcd(x, y)
def gcd(*numbers):
    return reduce(_gcd, numbers)
def lcm(*numbers):
    return reduce(_lcm, numbers)
sys.setrecursionlimit(1000000)
INF = float('inf')
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

L, R = LI()

ret = INF

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

print(ret)

Solution (Python):
l,r = map(int,input().split())

for i in range(l, min(l + 2040, r + 1)):
        if i % 2019 == 0:
                print(0)
                exit()

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

Solution (Python):
l,r=map(int,input().split())
n=(l//2019)
l-=2019*n;r-=2019*n
if 2019<=r: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)