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

MOD = 2019



if R - L >= MOD - 1:

    print((0))

    exit()



if L % MOD < R % MOD:

    a = [n for n in range(L % MOD, R % MOD + 1)]

elif L % MOD > R % MOD:

    a = [n for n in range(L % MOD, MOD)] + [n for n in range(R % MOD + 1)]

else:

    a = list(range(MOD))



ans = MOD - 1

for i in range(len(a)):

    for j in range(i + 1, len(a)):

        ans = min(ans, (a[i] * a[j]) % MOD)



print(ans)

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

MOD = 2019



print((min(

    (i * j) % MOD

    for i in range(L, R + 1)

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

) if R - L < MOD - 1 else 0))

L, R = list(map(int, input().split()))
MOD = 2019
if R - L >= MOD - 1:
    print((0))
    exit()
if L % MOD < R % MOD:
    a = [n for n in range(L % MOD, R % MOD + 1)]
elif L % MOD > R % MOD:
    a = [n for n in range(L % MOD, MOD)] + [n for n in range(R % MOD + 1)]
else:
    a = list(range(MOD))
ans = MOD - 1
for i in range(len(a)):
    for j in range(i + 1, len(a)):
        ans = min(ans, (a[i] * a[j]) % MOD)
print(ans)

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

-if R - L >= MOD - 1: -    print((0)) -    exit() -if L % MOD < R % MOD: -    a = [n for n in range(L % MOD, R % MOD + 1)] -elif L % MOD > R % MOD: -    a = [n for n in range(L % MOD, MOD)] + [n for n in range(R % MOD + 1)] -else: -    a = list(range(MOD)) -ans = MOD - 1 -for i in range(len(a)): -    for j in range(i + 1, len(a)): -        ans = min(ans, (a[i] * a[j]) % MOD) -print(ans) +print( +    ( +        min((i * j) % MOD for i in range(L, R + 1) for j in range(i + 1, R + 1)) +        if R - L < MOD - 1 +        else 0 +    ) +)