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

MOD = 2019

INF = 10**5

ans = INF





if 2019 <= R-L:

    print((0))

else:

    x = L % MOD

    y = R % MOD

    if x < y:

        for i in range(x, y):

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

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

        else:

            print(ans)

    else:

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

MOD = 2019

INF = 10**5

ans = INF





if 2019 <= R-L:

    print((0))

else:

    x = L % MOD

    y = R % MOD

    if x < y:

        for i in range(x, y):

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

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

            if ans == 0:

                break

        print(ans)

    else:

        print((0))
L, R = list(map(int, input().split()))
MOD = 2019
INF = 10**5
ans = INF
if 2019 <= R - L:
    print((0))
else:
    x = L % MOD
    y = R % MOD
    if x < y:
        for i in range(x, y):
            for j in range(i + 1, y + 1):
                ans = min(ans, (i * j) % MOD)
        else:
            print(ans)
    else:
        print((0))

L, R = list(map(int, input().split()))
MOD = 2019
INF = 10**5
ans = INF
if 2019 <= R - L:
    print((0))
else:
    x = L % MOD
    y = R % MOD
    if x < y:
        for i in range(x, y):
            for j in range(i + 1, y + 1):
                ans = min(ans, (i * j) % MOD)
            if ans == 0:
                break
        print(ans)
    else:
        print((0))

-        else: -            print(ans) +            if ans == 0: +                break +        print(ans)