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

rng = r - l

ans = float("inf")

if rng >= 2018:

    ans = 0

else:

    for i in range(l, r):

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

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

print(ans)
def main():

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

    rng = r - l

    ans = float("inf")

    if rng >= 2018:

        ans = 0

    else:

        for i in range(l, r):

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

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

    print(ans)





if __name__ == "__main__":

    main()
l, r = list(map(int, input().split()))
rng = r - l
ans = float("inf")
if rng >= 2018:
    ans = 0
else:
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            ans = min(ans, (i * j) % 2019)
print(ans)

def main():
    l, r = list(map(int, input().split()))
    rng = r - l
    ans = float("inf")
    if rng >= 2018:
        ans = 0
    else:
        for i in range(l, r):
            for j in range(i + 1, r + 1):
                ans = min(ans, (i * j) % 2019)
    print(ans)


if __name__ == "__main__":
    main()

-l, r = list(map(int, input().split())) -rng = r - l -ans = float("inf") -if rng >= 2018: -    ans = 0 -else: -    for i in range(l, r): -        for j in range(i + 1, r + 1): -            ans = min(ans, (i * j) % 2019) -print(ans) +def main(): +    l, r = list(map(int, input().split())) +    rng = r - l +    ans = float("inf") +    if rng >= 2018: +        ans = 0 +    else: +        for i in range(l, r): +            for j in range(i + 1, r + 1): +                ans = min(ans, (i * j) % 2019) +    print(ans) + + +if __name__ == "__main__": +    main()