L, R = [int(x) for x in input().split()]



if R - L >= 2018:

    ans = 0

else:

    ans = 2018

    for i in range(L, R):

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

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



print(ans)
L, R = [int(x) for x in input().split()]



if R - L >= 2018:

    ans = 0

else:

    ans = 2018

    for i in range(L, R):

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

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

            if ans == 0: break

        else:

            continue

        break



print(ans)

L, R = [int(x) for x in input().split()]
if R - L >= 2018:
    ans = 0
else:
    ans = 2018
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, i * j % 2019)
print(ans)

L, R = [int(x) for x in input().split()]
if R - L >= 2018:
    ans = 0
else:
    ans = 2018
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, i * j % 2019)
            if ans == 0:
                break
        else:
            continue
        break
print(ans)

+            if ans == 0: +                break +        else: +            continue +        break