import numpy as np



def ABC133C(l, r):

    Min = np.inf

    for i in range(l, r):

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

            a = (i * j) % 2019

            if a < Min:

                Min = a

                if a == 0: # ここに注目

                    print(Min)

                    return

    print(Min)



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

ABC133C(l, r)

def ABC133C(l, r):

    Min = 1e10

    for i in range(l, r):

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

            a = (i * j) % 2019

            if a < Min:

                Min = a

                if a == 0: # ここに注目

                    print(Min)

                    return

    print(Min)



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

ABC133C(l, r)

import numpy as np


def ABC133C(l, r):
    Min = np.inf
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            a = (i * j) % 2019
            if a < Min:
                Min = a
                if a == 0:  # ここに注目
                    print(Min)
                    return
    print(Min)


l, r = list(map(int, input().split()))
ABC133C(l, r)

def ABC133C(l, r):
    Min = 1e10
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            a = (i * j) % 2019
            if a < Min:
                Min = a
                if a == 0:  # ここに注目
                    print(Min)
                    return
    print(Min)


l, r = list(map(int, input().split()))
ABC133C(l, r)

-import numpy as np - - -    Min = np.inf +    Min = 1e10