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

#2019の倍数が入っていれば０→R-Lが２０１９以上

if R-L>=2019:

    print((0))

    exit()



ans=2019

for i in range(L,R):

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

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

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



if R - L >= 2019:

    print((0))

    

else:

    ans=float("INF")

    for i in range(L, R):

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

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

    print(ans)
L, R = list(map(int, input().split()))
# 2019の倍数が入っていれば０→R-Lが２０１９以上
if R - L >= 2019:
    print((0))
    exit()
ans = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % 2019)
print(ans)

L, R = list(map(int, input().split()))
if R - L >= 2019:
    print((0))
else:
    ans = float("INF")
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i * j) % 2019)
    print(ans)

-# 2019の倍数が入っていれば０→R-Lが２０１９以上 -    exit() -ans = 2019 -for i in range(L, R): -    for j in range(i + 1, R + 1): -        ans = min(ans, (i * j) % 2019) -print(ans) +else: +    ans = float("INF") +    for i in range(L, R): +        for j in range(i + 1, R + 1): +            ans = min(ans, (i * j) % 2019) +    print(ans)