import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int left = Integer.parseInt(in.next());
        int right = Integer.parseInt(in.next());
        in.close();
        int leftdiv = left / 2019;
        int rightdiv = right / 2019;
        int leftMod = left % 2019;
        int rightMod = right % 2019;
        int ans = -1;
        if (leftdiv == rightdiv) {
            lp:
            for (int i = leftMod; i < rightMod; i++) {
                for (int j = i + 1; j <= rightMod; j++) {
                    if (i * j % 2019 < ans || ans == -1) {
                        ans = i * j % 2019;
                    }
                    if (ans == 0) break lp;
                }
            }
        } else {
            ans = 0;
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int left = Integer.parseInt(in.next());
        int right = Integer.parseInt(in.next());
        in.close();
        int leftdiv = left / 2019;
        int rightdiv = right / 2019;
        int leftMod = left % 2019;
        int rightMod = right % 2019;
        int ans = -1;
        if (leftdiv == rightdiv) {
            lp:
            for (int i = leftMod; i < rightMod; i++) {
                for (int j = i + 1; j <= rightMod; j++) {
                    if (i * j % 2019 < ans || ans == -1) {
                        ans = i * j % 2019;
                    }
                    if (ans == 0) break lp;
                }
            }
        } else {
            ans = 0;
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int left = Integer.parseInt(in.next());
        int right = Integer.parseInt(in.next());
        in.close();
        int leftdiv = left / 2019;
        int rightdiv = right / 2019;
        int leftMod = left % 2019;
        int rightMod = right % 2019;
        int ans = -1;
        if (leftdiv == rightdiv) {
            lp:
            for (int i = leftMod; i < rightMod; i++) {
                for (int j = i + 1; j <= rightMod; j++) {
                    if (i * j % 2019 < ans || ans == -1) {
                        ans = i * j % 2019;
                    }
                    if (ans == 0) break lp;
                }
            }
        } else {
            ans = 0;
        }
        System.out.println(ans);
    } main {
        Scanner in = new Scanner(System.in);
        int left = Integer.parseInt(in.next());
        int right = Integer.parseInt(in.next());
        in.close();
        int leftdiv = left / 2019;
        int rightdiv = right / 2019;
        int leftMod = left % 2019;
        int rightMod = right % 2019;
        int ans = -1;
        if (leftdiv == rightdiv) {
            lp:
            for (int i = leftMod; i < rightMod; i++) {
                for (int j = i + 1; j <= rightMod; j++) {
                    if (i * j % 2019 < ans || ans == -1) {
                        ans = i * j % 2019;
                    }
                    if (ans == 0) break lp;
                }
            }
        } else {
            ans = 0;
        }
        System.out.println(ans);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int left = Integer.parseInt(in.next()); left Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in int right = Integer.parseInt(in.next()); right Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in in.close() in.close in int leftdiv = left / 2019; leftdiv left / 2019 left 2019 int rightdiv = right / 2019; rightdiv right / 2019 right 2019 int leftMod = left % 2019; leftMod left % 2019 left 2019 int rightMod = right % 2019; rightMod right % 2019 right 2019 int ans = -1; ans -1 1 if (leftdiv == rightdiv) {
            lp:
            for (int i = leftMod; i < rightMod; i++) {
                for (int j = i + 1; j <= rightMod; j++) {
                    if (i * j % 2019 < ans || ans == -1) {
                        ans = i * j % 2019;
                    }
                    if (ans == 0) break lp;
                }
            }
        } else {
            ans = 0;
        } leftdiv == rightdiv leftdiv rightdiv {
            lp:
            for (int i = leftMod; i < rightMod; i++) {
                for (int j = i + 1; j <= rightMod; j++) {
                    if (i * j % 2019 < ans || ans == -1) {
                        ans = i * j % 2019;
                    }
                    if (ans == 0) break lp;
                }
            }
        } {
            ans = 0;
        } ans = 0 ans 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int left = Integer.parseInt(in.next());
        int right = Integer.parseInt(in.next());
        in.close();
        int leftdiv = left / 2019;
        int rightdiv = right / 2019;
        int leftMod = left % 2019;
        int rightMod = right % 2019;
        int ans = -1;
        if (leftdiv == rightdiv) {
            lp:
            for (int i = leftMod; i < rightMod; i++) {
                for (int j = i + 1; j <= rightMod; j++) {
                    if (i * j % 2019 < ans || ans == -1) {
                        ans = i * j % 2019;
                    }
                    if (ans == 0) break lp;
                }
            }
        } else {
            ans = 0;
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int left = Integer.parseInt(in.next());
        int right = Integer.parseInt(in.next());
        in.close();
        int leftdiv = left / 2019;
        int rightdiv = right / 2019;
        int leftMod = left % 2019;
        int rightMod = right % 2019;
        int ans = -1;
        if (leftdiv == rightdiv) {
            lp:
            for (int i = leftMod; i < rightMod; i++) {
                for (int j = i + 1; j <= rightMod; j++) {
                    if (i * j % 2019 < ans || ans == -1) {
                        ans = i * j % 2019;
                    }
                    if (ans == 0) break lp;
                }
            }
        } else {
            ans = 0;
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int left = Integer.parseInt(in.next());
        int right = Integer.parseInt(in.next());
        in.close();
        int leftdiv = left / 2019;
        int rightdiv = right / 2019;
        int leftMod = left % 2019;
        int rightMod = right % 2019;
        int ans = -1;
        if (leftdiv == rightdiv) {
            lp:
            for (int i = leftMod; i < rightMod; i++) {
                for (int j = i + 1; j <= rightMod; j++) {
                    if (i * j % 2019 < ans || ans == -1) {
                        ans = i * j % 2019;
                    }
                    if (ans == 0) break lp;
                }
            }
        } else {
            ans = 0;
        }
        System.out.println(ans);
    }
}
