import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  long l, r;
  readf("%s %s\n", &l, &r);
  long res = l % 2019;
  long index = l;
  foreach (long i; l+1..r) {
    auto t = i % 2019;
    if (t < res) {
      res = t;
      index = i;
    }
    if (res == 0) break;
  }
  long res2 = (res * (index+1)) % 2019;
  
  foreach (long j; index+1..r+1) {
    auto t = (res * j) % 2019;
    if (t < res2) {
      res2 = t;
    }
    if (res2 == 0) break;
  }

  res2.writeln;
}
