l,r = list(map(int,input().split()))

l2 = l % 2019

r2 = r % 2019

if r - l >= 2019:

    print((0))

    exit()

else:

    result = 2018

    for i in range(l,r):

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

            result = min(result,(i*j)% 2019)

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

l2 = l % 2019

r2 = r % 2019

if r - l >= 2019:

    print((0))

    exit()

else:

    result = 2018

    for i in range(l,r):

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

            result = min(result,(i*j)% 2019)

            if result == 0:

                print((0))

                exit()

    print(result)

l, r = list(map(int, input().split()))
l2 = l % 2019
r2 = r % 2019
if r - l >= 2019:
    print((0))
    exit()
else:
    result = 2018
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            result = min(result, (i * j) % 2019)
    print(result)

l, r = list(map(int, input().split()))
l2 = l % 2019
r2 = r % 2019
if r - l >= 2019:
    print((0))
    exit()
else:
    result = 2018
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            result = min(result, (i * j) % 2019)
            if result == 0:
                print((0))
                exit()
    print(result)

+            if result == 0: +                print((0)) +                exit()