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

def doit(l, r):

#  l = l % 2019

#  r = r % 2019

#  if r <= l:

#    r += 2019

  res = 2018

  for x in range(l, r):

    for y in range(x + 1, r + 1):

      #print(x, y, file=sys.stderr)

      res = min(res, (x * y) % 2019)

      if res == 0:

        return 0

  return res % 2019



print((doit(l, r)))

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

def doit(l, r):

  if r - l > 2019:

    return 0

  l = l % 2019

  r = r % 2019

  if l == 0:

    return 0

  if r == 0:

    return 0

  if r <= l:

    r += 2019

  res = 2019

  for x in range(l, r):

    for y in range(x + 1, r + 1):

      #print(x, y, file=sys.stderr)

      res = min(res, (x * y) % 2019)

      if res == 0:

        return 0

  return res % 2019



print((doit(l, r)))

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


def doit(l, r):
    #  l = l % 2019
    #  r = r % 2019
    #  if r <= l:
    #    r += 2019
    res = 2018
    for x in range(l, r):
        for y in range(x + 1, r + 1):
            # print(x, y, file=sys.stderr)
            res = min(res, (x * y) % 2019)
            if res == 0:
                return 0
    return res % 2019


print((doit(l, r)))

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


def doit(l, r):
    if r - l > 2019:
        return 0
    l = l % 2019
    r = r % 2019
    if l == 0:
        return 0
    if r == 0:
        return 0
    if r <= l:
        r += 2019
    res = 2019
    for x in range(l, r):
        for y in range(x + 1, r + 1):
            # print(x, y, file=sys.stderr)
            res = min(res, (x * y) % 2019)
            if res == 0:
                return 0
    return res % 2019


print((doit(l, r)))

-    #  l = l % 2019 -    #  r = r % 2019 -    #  if r <= l: -    #    r += 2019 -    res = 2018 +    if r - l > 2019: +        return 0 +    l = l % 2019 +    r = r % 2019 +    if l == 0: +        return 0 +    if r == 0: +        return 0 +    if r <= l: +        r += 2019 +    res = 2019