import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = l; i < r && i < l + 2019; i++) {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        }
        System.out.println(min);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = l; i < r && i < l + 2019; i++) {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        }
        System.out.println(min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = l; i < r && i < l + 2019; i++) {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        }
        System.out.println(min);
    } main {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = l; i < r && i < l + 2019; i++) {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        }
        System.out.println(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 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = l; i < r && i < l + 2019; i++) {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        } int i = l; int i = l; i l i < r && i < l + 2019 i < r i r i < l + 2019 i l + 2019 l 2019 i++ i++ i {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        } {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        } for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= r && j < l + 2019 j <= r j r j < l + 2019 j l + 2019 l 2019 j++ j++ j {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            } {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            } int mi = i % 2019; mi i % 2019 i 2019 int mj = j % 2019; mj j % 2019 j 2019 int mm = (mi * mj) % 2019; mm (mi * mj) % 2019 (mi * mj) mi mj 2019 if (mm < min) {
                    min = mm;
                } mm < min mm min {
                    min = mm;
                } min = mm min mm System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = l; i < r && i < l + 2019; i++) {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        }
        System.out.println(min);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = l; i < r && i < l + 2019; i++) {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        }
        System.out.println(min);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = l; i < r && i < l + 2019; i++) {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        }
        System.out.println(min);
    }
}
