"use strict";
(function(input){
  input=input.trim();
  input=input.split(/\s+/).map(x=>x-0);
  let L=input[0],R=input[1];
  if((L-L%2019)/2019!==(R-R%2019)/2019){
    console.log(0);
    return;
  }
  let ans=Infinity;
  L=L%2019,R=R%2019;
  for(let i=L;i<R;i++){
    for(let j=i+1;j<=R;j++){
      if((i*j)%2019<ans){
        ans=(i*j)%2019;
      }
    }
  }
  console.log(ans);
})(require("fs").readFileSync("/dev/stdin","utf8"));
