import java.util.Scanner

import scala.annotation.tailrec
import scala.collection.mutable.ArrayBuffer


object Main {
  def read() = {
    val sc = new Scanner(System.in)
    val l, r = sc.nextInt()
    (l, r)
  }

  def solve(l: Int, r: Int): Long = {
    val mod = 2019
    // 0~2018が必要条件
    val ml = l % mod
    val mr = r % mod
    // ml <= mr の場合: [ml, mr]の範囲
    // ml > mrの場合: [0, mr], [ml, 2018]

    if(mr < ml) return 0
    var dl = l / mod
    var dr = r / mod

    val range: IndexedSeq[Int] = ml to mr
    if(dl == dr) {
      (for (i <- range; j <- range; if i < j) yield {
        i * j % mod
      }).min
    }else{
      (for (i <- range; j <- range; if i <= j) yield {
        i * j % mod
      }).min
    }
  }

  def main(args: Array[String]): Unit = {
    val (l, r) = read()
    println(solve(l, r))
  }
}