let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (L, R) = (input[0], input[1])
var ans = 2019
loop: for i in L..<R {
  for j in i+1...R {
    ans = min((i*j)%2019, ans)
    if ans == 0 {
      break loop
    }
  }
}
print(ans)