import sys

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

ans = []



def calc_mod(x, y):

    return x * y % 2019



left = L % 2019

right = R % 2019



if R-L > 2019:

    print((0))

    sys.exit(0)



elif left > right:

    print((0))

    sys.exit(0)



elif left==0 or right==0:

    print((0))

    sys.exit(0)



for i in range(left, right):

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

        ans.append(calc_mod(i, j))



print((min(ans)))
import sys

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

ans = []



def calc_mod(x, y):

    return x * y % 2019



left = L % 2019

right = R % 2019



if R-L > 2019:

    print((0))

    sys.exit(0)



elif left > right:

    print((0))

    sys.exit(0)



elif left==0 or right==0:

    print((0))

    sys.exit(0)



for i in range(left, right):

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

        x = calc_mod(i, j)

        if x==0:

            print((0))

            sys.exit(0)

        ans.append(x)



print((min(ans)))
import sys

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


def calc_mod(x, y):
    return x * y % 2019


left = L % 2019
right = R % 2019
if R - L > 2019:
    print((0))
    sys.exit(0)
elif left > right:
    print((0))
    sys.exit(0)
elif left == 0 or right == 0:
    print((0))
    sys.exit(0)
for i in range(left, right):
    for j in range(i + 1, right + 1):
        ans.append(calc_mod(i, j))
print((min(ans)))

import sys

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


def calc_mod(x, y):
    return x * y % 2019


left = L % 2019
right = R % 2019
if R - L > 2019:
    print((0))
    sys.exit(0)
elif left > right:
    print((0))
    sys.exit(0)
elif left == 0 or right == 0:
    print((0))
    sys.exit(0)
for i in range(left, right):
    for j in range(i + 1, right + 1):
        x = calc_mod(i, j)
        if x == 0:
            print((0))
            sys.exit(0)
        ans.append(x)
print((min(ans)))

-        ans.append(calc_mod(i, j)) +        x = calc_mod(i, j) +        if x == 0: +            print((0)) +            sys.exit(0) +        ans.append(x)