import math

from itertools import product

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

if R-L >= 2018:

    print((0))

else:

    ans = 2018

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

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

    print(ans)



def solve(string):

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

    if r - l >= 2019:

        return "0"

    return str(min({i * j % 2019 for i in range(l, r + 1) for j in range(i+1, r + 1)}))





if __name__ == '__main__':

    print((solve(eval(input()))))

import math
from itertools import product

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

def solve(string):
    l, r = list(map(int, string.split()))
    if r - l >= 2019:
        return "0"
    return str(
        min({i * j % 2019 for i in range(l, r + 1) for j in range(i + 1, r + 1)})
    )


if __name__ == "__main__":
    print((solve(eval(input()))))

-import math -from itertools import product +def solve(string): +    l, r = list(map(int, string.split())) +    if r - l >= 2019: +        return "0" +    return str( +        min({i * j % 2019 for i in range(l, r + 1) for j in range(i + 1, r + 1)}) +    ) -L, R = list(map(int, input().split())) -if R - L >= 2018: -    print((0)) -else: -    ans = 2018 -    for i, j in product(list(range(L, R)), list(range(L + 1, R + 1))): -        ans = min(ans, i * j % 2019) -    print(ans) + +if __name__ == "__main__": +    print((solve(eval(input()))))