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

ans = float('inf')

for i in range(l,min(l+2019,r)):

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

        val = i*j % 2019

        if val < ans:

            ans = val

print(ans)
def main():

    L, R = (int(i) for i in input().split())

    MOD = 2019

    R = min(L + 2020, R)

    ans = 2020

    for i in range(L, R):

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

            # print(i, j)

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

    print(ans)





if __name__ == '__main__':

    main()

l, r = (int(i) for i in input().split())
ans = float("inf")
for i in range(l, min(l + 2019, r)):
    for j in range(i + 1, min(i + 1 + 2019, r + 1)):
        val = i * j % 2019
        if val < ans:
            ans = val
print(ans)

def main():
    L, R = (int(i) for i in input().split())
    MOD = 2019
    R = min(L + 2020, R)
    ans = 2020
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            # print(i, j)
            ans = min(ans, (i * j) % MOD)
    print(ans)


if __name__ == "__main__":
    main()

-l, r = (int(i) for i in input().split()) -ans = float("inf") -for i in range(l, min(l + 2019, r)): -    for j in range(i + 1, min(i + 1 + 2019, r + 1)): -        val = i * j % 2019 -        if val < ans: -            ans = val -print(ans) +def main(): +    L, R = (int(i) for i in input().split()) +    MOD = 2019 +    R = min(L + 2020, R) +    ans = 2020 +    for i in range(L, R): +        for j in range(i + 1, R + 1): +            # print(i, j) +            ans = min(ans, (i * j) % MOD) +    print(ans) + + +if __name__ == "__main__": +    main()