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

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

const MOD = 2019;

long calc(long L, long R) {
    const mod = 2019;

    long ans = int.max;
    int[int] i_used;
    for (long i = L; i <= R; i++) {
        if (i_used[i % mod]++) continue;

        int[int] j_used;
        for (long j = i + 1; j <= R; j++) {
            if (j_used[j % mod]++) continue;

            ans = min(ans, (i % mod) * (j % mod) % mod);
        }
    }
    return ans;
}

long calc1(long L, long R) {
    long ans = int.max;
    for (long i = L; i <= R; i++) {
        for (long j = i + 1; j <= R; j++) {
            long m = i * j % MOD;
            ans = min(ans, m);
            if (ans == 0) goto END;
        }
    }
END:
    return ans;
}

void main() {
    int L, R; scan(L, R);
    writeln(calc1(L, R));
}
