'use strict'

const main = input => {
	const args = input.trim().split(' ')
	const L = parseInt(args[0], 10)
	const R = parseInt(args[1], 10)
	
	if (R - L >= 2018) {
		console.log(0)
	} else {
		let min = 2018
		const L2 = L % 2019
		const R2 = R % 2019

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

		console.log(min)
	}
}

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