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

MOD = 2019

l = L % MOD

r = R % MOD

ans = 2019



if l >= r or (R - L) >= 2019:

    ans = 0

else:

    for i in range(l, r):

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

            if j <= i:

                continue

            else:

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



print(ans)

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



ans = 10 ** 9

if R - L >= 673:

    ans = 0

else:

    for i in range(L, R):

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

            work = (i * j) % 2019

            # print(i, j, work, ans)

            ans = min(ans, work)



print(ans)

            

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

L, R = list(map(int, input().split()))
ans = 10**9
if R - L >= 673:
    ans = 0
else:
    for i in range(L, R):
        for j in range(L + 1, R + 1):
            work = (i * j) % 2019
            # print(i, j, work, ans)
            ans = min(ans, work)
print(ans)

-MOD = 2019 -l = L % MOD -r = R % MOD -ans = 2019 -if l >= r or (R - L) >= 2019: +ans = 10**9 +if R - L >= 673: -    for i in range(l, r): -        for j in range(l + 1, r + 1): -            if j <= i: -                continue -            else: -                ans = min(ans, i * j % MOD) +    for i in range(L, R): +        for j in range(L + 1, R + 1): +            work = (i * j) % 2019 +            # print(i, j, work, ans) +            ans = min(ans, work)