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++) {
    var num = parseInt(L) + i
    for (var j = 0; j < R - L - i; j++) {
      temp = num * (parseInt(L) + i + j + 1)
      if (temp % 2019 < result) {
        result = temp % 2019
      }
    }
    if (result === 0) {
      break
    }
  }

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

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