def slove():

    import sys

    input = sys.stdin.readline

    l, r = list(map(int, input().rstrip('\n').split()))

    m = 10 ** 10

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

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

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

            if m == 0:

                print(m)

                exit()

    print(m)





if __name__ == '__main__':

    slove()

import sys





def slove():

    input = sys.stdin.readline

    l, r = list(map(int, input().rstrip('\n').split()))

    mt = 10 ** 10

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

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

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

            if mt == 0:

                print(mt)

                exit()

    print(mt)





if __name__ == '__main__':

    slove()

def slove():
    import sys

    input = sys.stdin.readline
    l, r = list(map(int, input().rstrip("\n").split()))
    m = 10**10
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            m = min(m, (i * j) % 2019)
            if m == 0:
                print(m)
                exit()
    print(m)


if __name__ == "__main__":
    slove()

import sys


def slove():
    input = sys.stdin.readline
    l, r = list(map(int, input().rstrip("\n").split()))
    mt = 10**10
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            mt = min(mt, (i * j) % 2019)
            if mt == 0:
                print(mt)
                exit()
    print(mt)


if __name__ == "__main__":
    slove()

+import sys + + -    import sys - -    m = 10**10 +    mt = 10**10 -            m = min(m, (i * j) % 2019) -            if m == 0: -                print(m) +            mt = min(mt, (i * j) % 2019) +            if mt == 0: +                print(mt) -    print(m) +    print(mt)