import std.stdio, std.math, std.algorithm, std.array, std.string, std.conv, std.container, std.range;
pragma(inline, true) T[] Reads(T)() { return readln.split.to!(T[]); }
alias reads = Reads!int;
pragma(inline, true) void scan(Args...)(ref Args args) {
    string[] ss = readln.split;
    foreach (i, ref arg ; args) arg = ss[i].parse!int;
}

enum MOD = 2019;
void main() {
    int l, r; scan(l, r);
    if (r - l > 2019) {
        writeln(0);
        return ;
    }
    long ans = long.max;
    foreach(long i; l..r+1) foreach(long j; i+1..r+1) {
        ans = min(ans, (i%MOD*j%MOD) % MOD);
    }
    writeln(ans);
}
