
def main():
    l, r = list(map(int, input().split(" ")))

    m = 3000
    for i in range(l, r):
        for j in range(i+1, r+1):
            r = (i*j) % 2019
            if r == 0:
                print(0)
                return
            else:
                m = min(m, r)
    print(m)


main()
