def main():

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

    if L + 2018 <= R:

        print((0))

        return

    print((min(i * j % 2019 for i in range(L, R + 1)

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

    return





main()

def main():

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

    # [3, 673]

    if L + 672 <= R:

        print((0))

        return

    print((min(i * j % 2019 for i in range(L, R + 1)

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

    return





main()

def main():
    L, R = list(map(int, input().split()))
    if L + 2018 <= R:
        print((0))
        return
    print((min(i * j % 2019 for i in range(L, R + 1) for j in range(i + 1, R + 1))))
    return


main()

def main():
    L, R = list(map(int, input().split()))
    # [3, 673]
    if L + 672 <= R:
        print((0))
        return
    print((min(i * j % 2019 for i in range(L, R + 1) for j in range(i + 1, R + 1))))
    return


main()

-    if L + 2018 <= R: +    # [3, 673] +    if L + 672 <= R: