l, r = (int(x) for x in input().split())

tmpmin = 2019

if r-l >= 2019:

    print((0))

else:

    for i in range(l, r):

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

            tmp = (i*j)%2019

            if tmp < tmpmin:

                tmpmin = tmp

                if tmpmin == 0:

                    break

    print(tmpmin)
import sys

l, r = (int(x) for x in input().split())

tmpmin = 2019

if r-l >= 2019:

    print((0))

else:

    for i in range(l, r):

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

            tmp = (i*j)%2019

            if tmp < tmpmin:

                tmpmin = tmp

                if tmpmin == 0:

                    print(tmpmin)

                    sys.exit()

    print(tmpmin)
l, r = (int(x) for x in input().split())
tmpmin = 2019
if r - l >= 2019:
    print((0))
else:
    for i in range(l, r):
        for j in range(l + 1, r + 1):
            tmp = (i * j) % 2019
            if tmp < tmpmin:
                tmpmin = tmp
                if tmpmin == 0:
                    break
    print(tmpmin)

import sys

l, r = (int(x) for x in input().split())
tmpmin = 2019
if r - l >= 2019:
    print((0))
else:
    for i in range(l, r):
        for j in range(l + 1, r + 1):
            tmp = (i * j) % 2019
            if tmp < tmpmin:
                tmpmin = tmp
                if tmpmin == 0:
                    print(tmpmin)
                    sys.exit()
    print(tmpmin)

+import sys + -                    break +                    print(tmpmin) +                    sys.exit()