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

mod = 2019



l = L // mod

r = R // mod



if l != r:

    print((0))

else:

   l_ = L % mod

   r_ = R % mod

   ans = 2019

   for i in range(l_, r_):

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

           a = i * j % mod

           ans = min(ans, a)

   print(ans)

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

mod = 2019



l = L // mod

r = R // mod



if l != r:

    print((0))

else:

    l_ = L % mod

    r_ = R % mod

    ans = 2019

    for i in range(l_, r_):

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

            a = i * j % mod

            ans = min(ans, a)

            if ans == 0:

                break

        if ans == 0:

            break

    print(ans)

L, R = list(map(int, input().split()))
mod = 2019
l = L // mod
r = R // mod
if l != r:
    print((0))
else:
    l_ = L % mod
    r_ = R % mod
    ans = 2019
    for i in range(l_, r_):
        for j in range(i + 1, r_ + 1):
            a = i * j % mod
            ans = min(ans, a)
    print(ans)

L, R = list(map(int, input().split()))
mod = 2019
l = L // mod
r = R // mod
if l != r:
    print((0))
else:
    l_ = L % mod
    r_ = R % mod
    ans = 2019
    for i in range(l_, r_):
        for j in range(i + 1, r_ + 1):
            a = i * j % mod
            ans = min(ans, a)
            if ans == 0:
                break
        if ans == 0:
            break
    print(ans)

+            if ans == 0: +                break +        if ans == 0: +            break