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];
  int ans = int.max;
  ulong end = L + min(R - L, 2019) + 1;
  foreach(i; L..(end - 1)) {
    foreach(j; (i+1)..end) {
      ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
    }
  }
  ans.writeln;
}
