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

	if(r - l >= 2019){
		println(0)
	}else{
		val a = l % 2019
		val b = r % 2019

		if(a == 0 || b == 0){
			println(0)
		}else if(a < b){
			var ans = Int.MaxValue
			for(i<-a until b){
				for(j<-i+1 to b){
					ans = math.min(ans, (i*j)%2019)
				}
			}

			println(ans)

		}else{
			println(0)
		}
	}
}