import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Integer.MAX_VALUE;
        long lim = Math.min(r, l + 4038);
        for (long i = l; i <= lim; ++i) {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        }
        System.out.println(min);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Integer.MAX_VALUE;
        long lim = Math.min(r, l + 4038);
        for (long i = l; i <= lim; ++i) {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        }
        System.out.println(min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Integer.MAX_VALUE;
        long lim = Math.min(r, l + 4038);
        for (long i = l; i <= lim; ++i) {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        }
        System.out.println(min);
    } main {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Integer.MAX_VALUE;
        long lim = Math.min(r, l + 4038);
        for (long i = l; i <= lim; ++i) {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        }
        System.out.println(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc long min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE long lim = Math.min(r, l + 4038); lim Math.min(r, l + 4038) Math.min Math r l + 4038 l 4038 for (long i = l; i <= lim; ++i) {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        } long i = l; long i = l; i l i <= lim i lim ++i ++i i {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        } {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        } for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= lim j lim ++j ++j j {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            } {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            } long m = (i * j) % 2019L; m (i * j) % 2019L (i * j) i j 2019L if (min > m) {
                    min = m;
                } min > m min m {
                    min = m;
                } min = m min m 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);
        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Integer.MAX_VALUE;
        long lim = Math.min(r, l + 4038);
        for (long i = l; i <= lim; ++i) {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        }
        System.out.println(min);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Integer.MAX_VALUE;
        long lim = Math.min(r, l + 4038);
        for (long i = l; i <= lim; ++i) {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        }
        System.out.println(min);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        long min = Integer.MAX_VALUE;
        long lim = Math.min(r, l + 4038);
        for (long i = l; i <= lim; ++i) {
            for (long j = i + 1; j <= lim; ++j) {
//                System.out.println(String.format(">> %d, %d -- %d", i, j, (i * j) % 2019));
                long m = (i * j) % 2019L;
                if (min > m) {
                    min = m;
                }
            }
        }
        System.out.println(min);
    }
}
