import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long min = Long.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        }
        System.out.println(min);
    }

    private static long mod2019(long hoge) {
        return hoge % 2019;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long min = Long.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        }
        System.out.println(min);
    }

    private static long mod2019(long hoge) {
        return hoge % 2019;
    }
} Main public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long min = Long.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        }
        System.out.println(min);
    } main {

        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long min = Long.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        }
        System.out.println(min);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) long L = scanner.nextLong(); L scanner.nextLong() scanner.nextLong scanner long R = scanner.nextLong(); R scanner.nextLong() scanner.nextLong scanner long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for (long i = L; i < R; i++) {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        } long i = L; long i = L; i L i < R i R i++ i++ i {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        } {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        } for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            } long k = i+1; long k = i+1; k i+1 i 1 k <= R k R k++ k++ k {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            } {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            } long result = mod2019(i * k); result mod2019(i * k) mod2019 i * k i k if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                } result < min result min {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                } min = result min result if (min <= 0) {
                        System.out.println("0");
                        return;
                    } min <= 0 min 0 {
                        System.out.println("0");
                        return;
                    } System.out.println("0") System.out.println System.out System System.out "0" return; System.out.println(min) System.out.println System.out System System.out min String[] args args private static long mod2019(long hoge) {
        return hoge % 2019;
    } mod2019 {
        return hoge % 2019;
    } return hoge % 2019; hoge % 2019 hoge 2019 long hoge hoge public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long min = Long.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        }
        System.out.println(min);
    }

    private static long mod2019(long hoge) {
        return hoge % 2019;
    }
} public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long min = Long.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        }
        System.out.println(min);
    }

    private static long mod2019(long hoge) {
        return hoge % 2019;
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long min = Long.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long k = i+1; k <= R; k++) {
                long result = mod2019(i * k);
                if (result < min) {
                    min = result;
                    if (min <= 0) {
                        System.out.println("0");
                        return;
                    }
                }
            }
        }
        System.out.println(min);
    }

    private static long mod2019(long hoge) {
        return hoge % 2019;
    }
}