l, r = list(map(int, input().split()))



result = None

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

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

        mod = i * j % 2019

        if result is None or result > mod:

            result = mod

            if result == 0:

                break

    if result is not None and result == 0:

        break

print(result)

def search(lower, upper, mod):

    min_remain = mod

    for i in range(lower, min(lower + mod - lower % mod, upper - 1) + 1):

        for j in range(i + 1, min(i + mod, upper) + 1):

            remain = i * j % mod

            if remain == 0:

                return 0

            if min_remain > remain:

                min_remain = remain

    return min_remain





l, r = list(map(int, input().split()))

print((search(l, r, 2019)))

l, r = list(map(int, input().split()))
result = None
for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1):
    for j in range(i + 1, min(i + 2019, r) + 1):
        mod = i * j % 2019
        if result is None or result > mod:
            result = mod
            if result == 0:
                break
    if result is not None and result == 0:
        break
print(result)

def search(lower, upper, mod):
    min_remain = mod
    for i in range(lower, min(lower + mod - lower % mod, upper - 1) + 1):
        for j in range(i + 1, min(i + mod, upper) + 1):
            remain = i * j % mod
            if remain == 0:
                return 0
            if min_remain > remain:
                min_remain = remain
    return min_remain


l, r = list(map(int, input().split()))
print((search(l, r, 2019)))

+def search(lower, upper, mod): +    min_remain = mod +    for i in range(lower, min(lower + mod - lower % mod, upper - 1) + 1): +        for j in range(i + 1, min(i + mod, upper) + 1): +            remain = i * j % mod +            if remain == 0: +                return 0 +            if min_remain > remain: +                min_remain = remain +    return min_remain + + -result = None -for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1): -    for j in range(i + 1, min(i + 2019, r) + 1): -        mod = i * j % 2019 -        if result is None or result > mod: -            result = mod -            if result == 0: -                break -    if result is not None and result == 0: -        break -print(result) +print((search(l, r, 2019)))