import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
  std.functional, std.container, std.typecons;

void main() {
  auto input = readln.split.to!(ulong[]);
  ulong L = input[0], R = input[1];
  /*if(R - L > 4000) {
    writeln(0);
    return;
  }*/

  int[] arr = new int[0];
  foreach(i; L..(R+1)) {
    arr ~= i % 2019;
  }
  arr.sort();

  writeln((arr[0] * arr[1]) % 2019);
}
