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

M=2019;l=L%M;r=R%M

print((0 if l>r or R-L>671 else min(i*j%M for i in range(l,r) for j in range(i+1,r+1))))
M=2019;L,R=list(map(int,input().split()))

l=L%M;r=R%M;a=M-1

if l<r and R-L<672:

  for i in range(l,r):

    for j in range(i+1,r+1):

      a=min(a,i*j%M)

      if a<2: break

    if a<2: break

else: a=0

print(a)
L, R = list(map(int, input().split()))
M = 2019
l = L % M
r = R % M
print(
    (
        0
        if l > r or R - L > 671
        else min(i * j % M for i in range(l, r) for j in range(i + 1, r + 1))
    )
)

M = 2019
L, R = list(map(int, input().split()))
l = L % M
r = R % M
a = M - 1
if l < r and R - L < 672:
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            a = min(a, i * j % M)
            if a < 2:
                break
        if a < 2:
            break
else:
    a = 0
print(a)

+M = 2019 -M = 2019 -print( -    ( -        0 -        if l > r or R - L > 671 -        else min(i * j % M for i in range(l, r) for j in range(i + 1, r + 1)) -    ) -) +a = M - 1 +if l < r and R - L < 672: +    for i in range(l, r): +        for j in range(i + 1, r + 1): +            a = min(a, i * j % M) +            if a < 2: +                break +        if a < 2: +            break +else: +    a = 0 +print(a)