((input) => {
  const data = input.split('\n');
  const line1 = data[0].split(' ');
  const L = +line1[0];
  const R = +line1[1];
  console.log((L % 2019) * (R % 2019) % 2019);
})(
  require("fs").readFileSync("/dev/stdin", "utf8")
);
