import scala.io.StdIn._
import java.util.Scanner

import java.util.Scanner





object Main extends App {

  val arr: Array[Int] = readLine().split(" ").map(_.toInt)
  val l = arr(0)
  val r = arr(1)

  val list = for {
    i <- l to r
    j <- l to r
  } yield if(i < j || i != j) i * j else 0

  val list2 = list.toSet.filter(_ != 0)

  val ans = list2.map(v => v % 2019).min
  
  println(ans)





//  val arr: Array[Int] = readLine().split(" ").map(_.toInt)
//  val n = arr(0)
//  val a = arr(1)
//  val b = arr(2)
//
//  def solution(n: Int, a: Int, b:Int) = {
//    Math.min(n*a, b)
//  }
//  println(solution(n,a,b))



import scala.io.StdIn._


object Main extends App {

  val arr: Array[Int] = readLine().split(" ").map(_.toInt)
  val l = arr(0)
  val r = arr(1)

  val list = for {
    i <- l to r
    j <- l to r
  } yield if(i < j || i != j) i * j else 0

  val list2 = list.toSet.filter(_ != 0)

  val ans = list2.map(v => v % 2019).min
  
  println(ans)




}