import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int L = Integer.parseInt(sc.next());
        int R = Integer.parseInt(sc.next());
        sc.close();

        long min = 2019;
        for (int i = L; i <= R - 1; i++) {
            for (int j = i + 1; j <= R; j++) {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            }
            if (min == 0) {
                break;
            }
        }
        out.printf("%d\n", min);
        out.flush();
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int L = Integer.parseInt(sc.next());
        int R = Integer.parseInt(sc.next());
        sc.close();

        long min = 2019;
        for (int i = L; i <= R - 1; i++) {
            for (int j = i + 1; j <= R; j++) {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            }
            if (min == 0) {
                break;
            }
        }
        out.printf("%d\n", min);
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int L = Integer.parseInt(sc.next());
        int R = Integer.parseInt(sc.next());
        sc.close();

        long min = 2019;
        for (int i = L; i <= R - 1; i++) {
            for (int j = i + 1; j <= R; j++) {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            }
            if (min == 0) {
                break;
            }
        }
        out.printf("%d\n", min);
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int L = Integer.parseInt(sc.next());
        int R = Integer.parseInt(sc.next());
        sc.close();

        long min = 2019;
        for (int i = L; i <= R - 1; i++) {
            for (int j = i + 1; j <= R; j++) {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            }
            if (min == 0) {
                break;
            }
        }
        out.printf("%d\n", min);
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int L = Integer.parseInt(sc.next()); L Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int R = Integer.parseInt(sc.next()); R Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc long min = 2019; min 2019 for (int i = L; i <= R - 1; i++) {
            for (int j = i + 1; j <= R; j++) {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            }
            if (min == 0) {
                break;
            }
        } int i = L; int i = L; i L i <= R - 1 i R - 1 R 1 i++ i++ i {
            for (int j = i + 1; j <= R; j++) {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            }
            if (min == 0) {
                break;
            }
        } {
            for (int j = i + 1; j <= R; j++) {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            }
            if (min == 0) {
                break;
            }
        } for (int j = i + 1; j <= R; j++) {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            } {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            } long calc = ((long)i * j) % 2019; calc ((long)i * j) % 2019 ((long)i * j) (long)i j 2019 if (calc < min) {
                    min = calc;
                } calc < min calc min {
                    min = calc;
                } min = calc min calc if (min == 0) {
                    break;
                } min == 0 min 0 {
                    break;
                } break; if (min == 0) {
                break;
            } min == 0 min 0 {
                break;
            } break; out.printf("%d\n", min) out.printf out "%d\n" min out.flush() out.flush out String[] args args
import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int L = Integer.parseInt(sc.next());
        int R = Integer.parseInt(sc.next());
        sc.close();

        long min = 2019;
        for (int i = L; i <= R - 1; i++) {
            for (int j = i + 1; j <= R; j++) {
                long calc = ((long)i * j) % 2019;
                if (calc < min) {
                    min = calc;
                }
                if (min == 0) {
                    break;
                }
            }
            if (min == 0) {
                break;
            }
        }
        out.printf("%d\n", min);
        out.flush();
    }
}
