'use strict'
function main(i) {
  i = i.trim().split(' ')
  const Y = 2019
  const R = Number(i[1])
  const L = Number(i[0])
  const diff = R - L

  const hasDivisible = diff - (R % Y)
  if (hasDivisible >= 0) {
    console.log(0)
  } else {
    let ans = -1
    for (let i = L; i < R; i++) {
      for (let j = i + 1; j <= R; j++) {
        let n = (i * j) % Y
        if (ans < 0 || n < ans) ans = n
        if (ans === 0) break
      }
      if (ans === 0) break
    }
    console.log(ans)
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
