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

l = L % 2019

r = R % 2019

ans = []

if R - L >= 2019:

    print((0))

else:

    if l >= r:

        print((0))

    else:

        for i in range(l, r):

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

                ans.append(i * k % 2019)                

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



if R - L > 2019:

    print((0))

else:

    l = L % 2019

    r = R % 2019

    ans = 10000000

    if r > l:

        for i in range(l, r):

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

                if ans > (i * k) % 2019:

                    ans = (i * k) % 2019

        print(ans)

    else:

        print((0))
L, R = list(map(int, input().split()))
l = L % 2019
r = R % 2019
ans = []
if R - L >= 2019:
    print((0))
else:
    if l >= r:
        print((0))
    else:
        for i in range(l, r):
            for k in range(l + 1, r + 1):
                ans.append(i * k % 2019)
    print((min(ans)))

L, R = list(map(int, input().split()))
if R - L > 2019:
    print((0))
else:
    l = L % 2019
    r = R % 2019
    ans = 10000000
    if r > l:
        for i in range(l, r):
            for k in range(i + 1, r + 1):
                if ans > (i * k) % 2019:
                    ans = (i * k) % 2019
        print(ans)
    else:
        print((0))

-l = L % 2019 -r = R % 2019 -ans = [] -if R - L >= 2019: +if R - L > 2019: -    if l >= r: +    l = L % 2019 +    r = R % 2019 +    ans = 10000000 +    if r > l: +        for i in range(l, r): +            for k in range(i + 1, r + 1): +                if ans > (i * k) % 2019: +                    ans = (i * k) % 2019 +        print(ans) +    else: -    else: -        for i in range(l, r): -            for k in range(l + 1, r + 1): -                ans.append(i * k % 2019) -    print((min(ans)))