def main():

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

    if R // 2019 > L // 2019:

        print((0))

        return

    retval = 2019

    for i in range(L, R):

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

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

    print(retval)

    return

    

if __name__ == '__main__':

    main()
def main():

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

    if R // 2019 > L // 2019:

        print((0))

        return

    retval = 2019

    for i in range(L, R):

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

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

            if retval == 0:

                print((0))

                return

            

    print(retval)

    return

    

if __name__ == '__main__':

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


if __name__ == "__main__":
    main()

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


if __name__ == "__main__":
    main()

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