'use strict'

const main = input => {
	const args = input.trim().split(' ').map(Number)
	const l = args[0]
	const r = args[1]
	let min = (2 * Math.pow(10, 9)) * 2 - 1

	for (let i = l; i < r; i++) {
		for (let j = i + 1; j <= r; j++) {
			min = Math.min(min, i * j % 2019)
		}
	}

	console.log(min)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
