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

r=2018

for i in range(L,min(R,L+2019)):

    for j in range(L+1,min(R+1,L+2020)):

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

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

if R-L>2018:

    print((0))

else:

    r=2018

    for i in range(L,min(R,L+2019)):

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

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

    print(r)
L, R = list(map(int, input().split()))
r = 2018
for i in range(L, min(R, L + 2019)):
    for j in range(L + 1, min(R + 1, L + 2020)):
        r = min(r, (i * j) % 2019)
print(r)

L, R = list(map(int, input().split()))
if R - L > 2018:
    print((0))
else:
    r = 2018
    for i in range(L, min(R, L + 2019)):
        for j in range(i + 1, min(R + 1, L + 2020)):
            r = min(r, (i * j) % 2019)
    print(r)

-r = 2018 -for i in range(L, min(R, L + 2019)): -    for j in range(L + 1, min(R + 1, L + 2020)): -        r = min(r, (i * j) % 2019) -print(r) +if R - L > 2018: +    print((0)) +else: +    r = 2018 +    for i in range(L, min(R, L + 2019)): +        for j in range(i + 1, min(R + 1, L + 2020)): +            r = min(r, (i * j) % 2019) +    print(r)