#!/usr/bin/env python3

import sys



MOD = 2019  # type: int





def solve(L: int, R: int):

    list_lr_mod = []

    ans = 2018



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

        list_lr_mod.append(x % MOD)



        if i + 1 >= 2019:

            print((0))

            return



    if 0 in list_lr_mod:

        print((0))

        return



    for i in range(len(list_lr_mod) - 1):

        for j in range(i + 1, len(list_lr_mod)):

            tmp = list_lr_mod[i] * list_lr_mod[j]

            ans = min(ans, tmp % MOD)



    print(ans)



# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    L = int(next(tokens))  # type: int

    R = int(next(tokens))  # type: int

    solve(L, R)



if __name__ == '__main__':

    main()

#!/usr/bin/env python3

import sys



MOD = 2019  # type: int





def solve(L: int, R: int):

    list_lr_mod = []

    ans = 2018



    if R - L >= 2018:

        print((0))

        return



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

        xmod = x % MOD

        if xmod == 0:

            print((0))

            return

        else:

            list_lr_mod.append(xmod)





    for i in range(len(list_lr_mod) - 1):

        for j in range(i + 1, len(list_lr_mod)):

            tmp = list_lr_mod[i] * list_lr_mod[j]

            ans = min(ans, tmp % MOD)



    print(ans)



# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    L = int(next(tokens))  # type: int

    R = int(next(tokens))  # type: int

    solve(L, R)



if __name__ == '__main__':

    main()

#!/usr/bin/env python3
import sys

MOD = 2019  # type: int


def solve(L: int, R: int):
    list_lr_mod = []
    ans = 2018
    for i, x in enumerate(range(L, R + 1)):
        list_lr_mod.append(x % MOD)
        if i + 1 >= 2019:
            print((0))
            return
    if 0 in list_lr_mod:
        print((0))
        return
    for i in range(len(list_lr_mod) - 1):
        for j in range(i + 1, len(list_lr_mod)):
            tmp = list_lr_mod[i] * list_lr_mod[j]
            ans = min(ans, tmp % MOD)
    print(ans)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)


if __name__ == "__main__":
    main()

#!/usr/bin/env python3
import sys

MOD = 2019  # type: int


def solve(L: int, R: int):
    list_lr_mod = []
    ans = 2018
    if R - L >= 2018:
        print((0))
        return
    for i, x in enumerate(range(L, R + 1)):
        xmod = x % MOD
        if xmod == 0:
            print((0))
            return
        else:
            list_lr_mod.append(xmod)
    for i in range(len(list_lr_mod) - 1):
        for j in range(i + 1, len(list_lr_mod)):
            tmp = list_lr_mod[i] * list_lr_mod[j]
            ans = min(ans, tmp % MOD)
    print(ans)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)


if __name__ == "__main__":
    main()

+    if R - L >= 2018: +        print((0)) +        return -        list_lr_mod.append(x % MOD) -        if i + 1 >= 2019: +        xmod = x % MOD +        if xmod == 0: -    if 0 in list_lr_mod: -        print((0)) -        return +        else: +            list_lr_mod.append(xmod)