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){
		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 if(a > b){
		var ans = Int.MaxValue
		for(i<-b until a){
			for(j<-i+1 to a){
				ans = math.min(ans, (i*j)%2019)
			}
		}

		println(ans)
	}else{
		println(0)
	}
}