def c_remainder_minimization_2019(L, R):

    ans = float('inf')

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

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

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

    return ans



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

print((c_remainder_minimization_2019(L, R)))
def c_remainder_minimization_2019(L, R):

    ans = float('inf')

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

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

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

            if ans == 0:

                return 0

    return ans



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

print((c_remainder_minimization_2019(L, R)))
def c_remainder_minimization_2019(L, R):
    ans = float("inf")
    for i in range(L, min(R, L + 2019)):
        for j in range(i + 1, min(R + 1, L + 2020)):
            ans = min(ans, (i * j) % 2019)
    return ans


L, R = [int(i) for i in input().split()]
print((c_remainder_minimization_2019(L, R)))

def c_remainder_minimization_2019(L, R):
    ans = float("inf")
    for i in range(L, min(R, L + 2019)):
        for j in range(i + 1, min(R + 1, L + 2020)):
            ans = min(ans, (i * j) % 2019)
            if ans == 0:
                return 0
    return ans


L, R = [int(i) for i in input().split()]
print((c_remainder_minimization_2019(L, R)))

+            if ans == 0: +                return 0