'use strict'

const main = input => {
	const args = input.trim().split(' ')
	const L = parseInt(args[0], 10)
	const R = parseInt(args[1], 10)
	let min = 2018

	for (let i = L; i < R; i++) {
		for (let j = i + 1; j <= R; j++) {
			min = Math.min(min, i * j % 2019)
			if (min === 0) break
		}

		if (min === 0) break
	}

	console.log(min)
}

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