object Main extends App {
  var a = readLine.split(" ").map(_.toInt)
  var sum = 2020L
    if(a(1)-a(0)<2019){
      for(i<-a(0) until a(1); j<-i+1 to a(1)) {
            sum = Math.min(sum,(i * j)%2019)
      }
    } else {
      sum = 0
    }
  print(sum)
}