import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        if (l >= r) {
            System.out.print(0);
        } else if (r - l > 2019) {
            System.out.print(0);
        } else {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(min);
        }
    }
} import java.util.Scanner; Scanner 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();

        if (l >= r) {
            System.out.print(0);
        } else if (r - l > 2019) {
            System.out.print(0);
        } else {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(min);
        }
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        if (l >= r) {
            System.out.print(0);
        } else if (r - l > 2019) {
            System.out.print(0);
        } else {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(min);
        }
    } main {

        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        if (l >= r) {
            System.out.print(0);
        } else if (r - l > 2019) {
            System.out.print(0);
        } else {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(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 if (l >= r) {
            System.out.print(0);
        } else if (r - l > 2019) {
            System.out.print(0);
        } else {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(min);
        } l >= r l r {
            System.out.print(0);
        } System.out.print(0) System.out.print System.out System System.out 0 if (r - l > 2019) {
            System.out.print(0);
        } else {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(min);
        } r - l > 2019 r - l r l 2019 {
            System.out.print(0);
        } System.out.print(0) System.out.print System.out System System.out 0 {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(min);
        } l = l % 2019 l l % 2019 l 2019 r = r % 2019 r r % 2019 r 2019 long min = 2018; min 2018 for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            } long i = l; long i = l; i l i < r i r i++ i++ i {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            } {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            } for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                } {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                } if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    } (i * j) % 2019 < min (i * j) % 2019 (i * j) i j 2019 min {
                        min = (i * j) % 2019;
                    } min = (i * j) % 2019 min (i * j) % 2019 (i * j) i j 2019 System.out.print(min) System.out.print 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();

        if (l >= r) {
            System.out.print(0);
        } else if (r - l > 2019) {
            System.out.print(0);
        } else {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(min);
        }
    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        if (l >= r) {
            System.out.print(0);
        } else if (r - l > 2019) {
            System.out.print(0);
        } else {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(min);
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();

        if (l >= r) {
            System.out.print(0);
        } else if (r - l > 2019) {
            System.out.print(0);
        } else {
            l = l % 2019;
            r = r % 2019;

            long min = 2018;
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    if ((i * j) % 2019 < min) {
                        min = (i * j) % 2019;
                    }
                }
            }
            System.out.print(min);
        }
    }
}