import numpy as np

a,b = list(map(int, input().split()))

mod = 2019

min_score = 2019



for i in range(a, b+1):

    for j in range(a, b+1):

        if i != j:

            temp = (i%mod)*(j%mod) %mod

            if min_score > temp:

                min_score = temp

            if min_score == 0:

                print(min_score)

                exit()



print(min_score)
import numpy as np

a,b = list(map(int, input().split()))

mod = 2019

min_score = 2019



for i in range(a, b+1):

    for j in range(a, b+1):

        if i != j:

            temp = (i)*(j) %mod

            if min_score > temp:

                min_score = temp

            if min_score == 0:

                print(min_score)

                exit()



print(min_score)
import numpy as np

a, b = list(map(int, input().split()))
mod = 2019
min_score = 2019
for i in range(a, b + 1):
    for j in range(a, b + 1):
        if i != j:
            temp = (i % mod) * (j % mod) % mod
            if min_score > temp:
                min_score = temp
            if min_score == 0:
                print(min_score)
                exit()
print(min_score)

import numpy as np

a, b = list(map(int, input().split()))
mod = 2019
min_score = 2019
for i in range(a, b + 1):
    for j in range(a, b + 1):
        if i != j:
            temp = (i) * (j) % mod
            if min_score > temp:
                min_score = temp
            if min_score == 0:
                print(min_score)
                exit()
print(min_score)

-            temp = (i % mod) * (j % mod) % mod +            temp = (i) * (j) % mod