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



if R - L >= 2050:

    print((0))

else:

    ans = 20000000

    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 >= 2050:

    print((0))

else:

    ans = 20000000

    for i in range(L, R):

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

            x = (i*j)%2019

            if x < ans:

                ans = x

    print(ans)

L, R = list(map(int, input().split()))
if R - L >= 2050:
    print((0))
else:
    ans = 20000000
    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 >= 2050:
    print((0))
else:
    ans = 20000000
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            x = (i * j) % 2019
            if x < ans:
                ans = x
    print(ans)

-            ans = min(ans, (i * j) % 2019) +            x = (i * j) % 2019 +            if x < ans: +                ans = x