object Main extends App {
	val Array(l, r) = scala.io.StdIn.readLine.split(" ").map(_.toInt)

	val a = l % 2019
	val b = r % 2019

	if(a == 0 || b == 0){
		println(0)
	}else if(a < b){
		println(a * (a+1))
	}else if(a > b){
		println(b * (b+1))
	}else{
		println(0)
	}
}