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



m = 2019

if R-L>=2018:

  for i in range(2019):

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

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

else:

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

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

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

  

print(m)
def solve():

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

    mod = 2019

    table = [[0]*2019 for _ in range(2019)]

    for i in range(2019):

        for j in range(2019):

            table[i][j] = i*j%mod

    ans = 10**7

    if R-L>=2018:

        for i in range(2019):

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

                ans = min(ans,table[i][j])

        return ans

    r = R%mod

    l = L%mod

    if r>=l:

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

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

                ans = min(ans,table[i][j])

        return ans

    for i in range(2019):

        if i<=r or i>=l:

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

                if j<=r or j>=l:

                    ans = min(ans,table[i][j])

    return ans

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

def solve():
    L, R = list(map(int, input().split()))
    mod = 2019
    table = [[0] * 2019 for _ in range(2019)]
    for i in range(2019):
        for j in range(2019):
            table[i][j] = i * j % mod
    ans = 10**7
    if R - L >= 2018:
        for i in range(2019):
            for j in range(i + 1, 2019):
                ans = min(ans, table[i][j])
        return ans
    r = R % mod
    l = L % mod
    if r >= l:
        for i in range(l, r + 1):
            for j in range(i + 1, r + 1):
                ans = min(ans, table[i][j])
        return ans
    for i in range(2019):
        if i <= r or i >= l:
            for j in range(i + 1, 2019):
                if j <= r or j >= l:
                    ans = min(ans, table[i][j])
    return ans


print((solve()))

-L, R = list(map(int, input().split())) -m = 2019 -if R - L >= 2018: +def solve(): +    L, R = list(map(int, input().split())) +    mod = 2019 +    table = [[0] * 2019 for _ in range(2019)] -        for j in range(i + 1, 2019): -            m = min(m, i * j % 2019) -else: -    for i in range(L, R + 1): -        for j in range(i + 1, R + 1): -            m = min(m, i * j % 2019) -print(m) +        for j in range(2019): +            table[i][j] = i * j % mod +    ans = 10**7 +    if R - L >= 2018: +        for i in range(2019): +            for j in range(i + 1, 2019): +                ans = min(ans, table[i][j]) +        return ans +    r = R % mod +    l = L % mod +    if r >= l: +        for i in range(l, r + 1): +            for j in range(i + 1, r + 1): +                ans = min(ans, table[i][j]) +        return ans +    for i in range(2019): +        if i <= r or i >= l: +            for j in range(i + 1, 2019): +                if j <= r or j >= l: +                    ans = min(ans, table[i][j]) +    return ans + + +print((solve()))