inf = 2019

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

ans = 0

df = R - L

if df < 2019:

    L = L % inf

    R = L + df

    ans = 2019

    for i in range(L, R):

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

            tmp = int((i * j) % inf)

            ans = min(ans, tmp)



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

MOD = 2019

diff = r - l

ans = 0

if diff < 2019:

    l = l % MOD

    r = l + diff

    ans = 2018

    for i in range(l, r):

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

            ans = min(ans, (i % MOD * j % MOD) % MOD)



print(ans)

inf = 2019
L, R = list(map(int, input().split()))
ans = 0
df = R - L
if df < 2019:
    L = L % inf
    R = L + df
    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            tmp = int((i * j) % inf)
            ans = min(ans, tmp)
print(ans)

l, r = list(map(int, input().split()))
MOD = 2019
diff = r - l
ans = 0
if diff < 2019:
    l = l % MOD
    r = l + diff
    ans = 2018
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            ans = min(ans, (i % MOD * j % MOD) % MOD)
print(ans)

-inf = 2019 -L, R = list(map(int, input().split())) +l, r = list(map(int, input().split())) +MOD = 2019 +diff = r - l -df = R - L -if df < 2019: -    L = L % inf -    R = L + df -    ans = 2019 -    for i in range(L, R): -        for j in range(i + 1, R + 1): -            tmp = int((i * j) % inf) -            ans = min(ans, tmp) +if diff < 2019: +    l = l % MOD +    r = l + diff +    ans = 2018 +    for i in range(l, r): +        for j in range(i + 1, r + 1): +            ans = min(ans, (i % MOD * j % MOD) % MOD)