import java.util.Scanner;

public class Main {


    void solve() {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();

        long min = Long.MAX_VALUE;
        for (int i = L; i <= R; i++) {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        }
        System.out.print(min);
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
}
 import java.util.Scanner; Scanner java.util public class Main {


    void solve() {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();

        long min = Long.MAX_VALUE;
        for (int i = L; i <= R; i++) {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        }
        System.out.print(min);
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} Main void solve() {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();

        long min = Long.MAX_VALUE;
        for (int i = L; i <= R; i++) {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        }
        System.out.print(min);
    } solve {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();

        long min = Long.MAX_VALUE;
        for (int i = L; i <= R; i++) {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        }
        System.out.print(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc int R = sc.nextInt(); R sc.nextInt() sc.nextInt sc long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for (int i = L; i <= R; i++) {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        } int i = L; int i = L; i L i <= R i R i++ i++ i {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        } {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        } for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            } {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            } long ij = ((long)i * j) % 2019; ij ((long)i * j) % 2019 ((long)i * j) (long)i j 2019 if (ij == 0) {
                    min = 0;
                    break;
                } ij == 0 ij 0 {
                    min = 0;
                    break;
                } min = 0 min 0 break; min = Math.min(min, ij) min Math.min(min, ij) Math.min Math min ij if (min == 0) {
                break;
            } min == 0 min 0 {
                break;
            } break; System.out.print(min) System.out.print System.out System System.out min // Main
    public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main {


    void solve() {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();

        long min = Long.MAX_VALUE;
        for (int i = L; i <= R; i++) {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        }
        System.out.print(min);
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} public class Main {


    void solve() {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();

        long min = Long.MAX_VALUE;
        for (int i = L; i <= R; i++) {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        }
        System.out.print(min);
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} Main
import java.util.Scanner;

public class Main {


    void solve() {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();

        long min = Long.MAX_VALUE;
        for (int i = L; i <= R; i++) {
            for (int j = i + 1; j <= R; j++) {
                long ij = ((long)i * j) % 2019;
                if (ij == 0) {
                    min = 0;
                    break;
                }
                min = Math.min(min, ij);
            }
            if (min == 0) {
                break;
            }
        }
        System.out.print(min);
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
}

