def solve():

    l,r = list(map(int, input().split()))

    if r-l<2019:

        arr = [i*j%2019 for i in range(l,r) for j in range(i+1,r+1)]

        return min(arr)

    else:

        return 0





if __name__ == '__main__':

    print((solve()))
def solve():

    l,r = list(map(int, input().split()))

    if r-l<2019:

        arr = []

        for i in range(l,r):

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

                if i*j%2019 == 0:

                    return 0

                arr.append(i*j%2019)

        return min(arr)

    else:

        return 0





if __name__ == '__main__':

    print((solve()))
def solve():
    l, r = list(map(int, input().split()))
    if r - l < 2019:
        arr = [i * j % 2019 for i in range(l, r) for j in range(i + 1, r + 1)]
        return min(arr)
    else:
        return 0


if __name__ == "__main__":
    print((solve()))

def solve():
    l, r = list(map(int, input().split()))
    if r - l < 2019:
        arr = []
        for i in range(l, r):
            for j in range(i + 1, r + 1):
                if i * j % 2019 == 0:
                    return 0
                arr.append(i * j % 2019)
        return min(arr)
    else:
        return 0


if __name__ == "__main__":
    print((solve()))

-        arr = [i * j % 2019 for i in range(l, r) for j in range(i + 1, r + 1)] +        arr = [] +        for i in range(l, r): +            for j in range(i + 1, r + 1): +                if i * j % 2019 == 0: +                    return 0 +                arr.append(i * j % 2019)