import sys



def solve():

    input = sys.stdin.readline

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

    if R - L >= 2018: print((0))

    else:

        ans = 2019

        for i in range(L, R):

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

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

        print(ans)

    

    return 0



if __name__ == "__main__":

    solve()
import sys



def solve():

    input = sys.stdin.readline

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

    if R - L >= 2019: print((0))

    else:

        minMod = 2019

        for i in range(L, R):

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

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

        print(minMod)



    return 0



if __name__ == "__main__":

    solve()
import sys


def solve():
    input = sys.stdin.readline
    L, R = list(map(int, input().split()))
    if R - L >= 2018:
        print((0))
    else:
        ans = 2019
        for i in range(L, R):
            for j in range(L + 1, R + 1):
                ans = min(ans, (i * j) % 2019)
        print(ans)
    return 0


if __name__ == "__main__":
    solve()

import sys


def solve():
    input = sys.stdin.readline
    L, R = list(map(int, input().split()))
    if R - L >= 2019:
        print((0))
    else:
        minMod = 2019
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                minMod = min((i * j) % 2019, minMod)
        print(minMod)
    return 0


if __name__ == "__main__":
    solve()

-    if R - L >= 2018: +    if R - L >= 2019: -        ans = 2019 +        minMod = 2019 -            for j in range(L + 1, R + 1): -                ans = min(ans, (i * j) % 2019) -        print(ans) +            for j in range(i + 1, R + 1): +                minMod = min((i * j) % 2019, minMod) +        print(minMod)