function Main(input) {
  var tmp = input.split(' ')
  var L = tmp[0]
  var R = tmp[1]

  var result = 2019
  var temp = 0

  for (var i = 0; i < R - L; i++) {
    for (var j = 1; j < R - L - i + 2; j++) {
      let num1 = parseInt(L) + i
      let num2 = parseInt(L) + i + j
      temp = num1 * num2
      if (temp % 2019 < result) {
        result = temp % 2019
      }
    }
  }

  console.log('%d', result)
}

var num = '4 5'

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