"use strict";
    
const main = arg => {
  
  let L = arg.split(" ")[0] % 2019,
      R = arg.split(" ")[1] % 2019;
  let min = 2018;
  for(let i = L; i <= R; i++){
    for(let j = L; j <= R; j++){
      let num = (i*j) % 2019;
      if(num < min && i != j){
      	min = num;
      }
  	}
  }
  
  console.log(min);
}

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