# ABC133C - Remainder Minimization 2019

def main():

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

    MOD = 2019

    if R - L + 1 >= MOD:  # L <= 2019n <= R

        print((0))

    else:  # max: 2018 * 2017 patterns

        ans = float("inf")

        L, R = L % MOD, R % MOD

        for i in range(L, R):

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

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

        print(ans)





if __name__ == "__main__":

    main()
# ABC133C - Remainder Minimization 2019

def main():

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

    MOD = 2019

    if R - L + 1 >= MOD:  # L <= 2019n <= R

        print((0))

    else:  # max: 2018 * 2017 patterns

        ans = float("inf")

        L, R = L % MOD, R % MOD

        for i in range(L, R):

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

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

                if ans == 0:

                    print(ans)

                    return

        print(ans)





if __name__ == "__main__":

    main()
# ABC133C - Remainder Minimization 2019
def main():
    L, R = list(map(int, input().rstrip().split()))
    MOD = 2019
    if R - L + 1 >= MOD:  # L <= 2019n <= R
        print((0))
    else:  # max: 2018 * 2017 patterns
        ans = float("inf")
        L, R = L % MOD, R % MOD
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                ans = min(ans, (i * j) % MOD)
        print(ans)


if __name__ == "__main__":
    main()

# ABC133C - Remainder Minimization 2019
def main():
    L, R = list(map(int, input().rstrip().split()))
    MOD = 2019
    if R - L + 1 >= MOD:  # L <= 2019n <= R
        print((0))
    else:  # max: 2018 * 2017 patterns
        ans = float("inf")
        L, R = L % MOD, R % MOD
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                ans = min(ans, (i * j) % MOD)
                if ans == 0:
                    print(ans)
                    return
        print(ans)


if __name__ == "__main__":
    main()

+                if ans == 0: +                    print(ans) +                    return