import java.util.Scanner;

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

        long min = Long.MAX_VALUE;
        for (long i = l; i <= Math.min(r, l + 2019) ; i++) {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        }

        System.out.println(min);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long l = in.nextInt();
        long r = in.nextInt();

        long min = Long.MAX_VALUE;
        for (long i = l; i <= Math.min(r, l + 2019) ; i++) {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        }

        System.out.println(min);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long l = in.nextInt();
        long r = in.nextInt();

        long min = Long.MAX_VALUE;
        for (long i = l; i <= Math.min(r, l + 2019) ; i++) {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        }

        System.out.println(min);
    } main {
        Scanner in = new Scanner(System.in);
        long l = in.nextInt();
        long r = in.nextInt();

        long min = Long.MAX_VALUE;
        for (long i = l; i <= Math.min(r, l + 2019) ; i++) {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        }

        System.out.println(min);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) long l = in.nextInt(); l in.nextInt() in.nextInt in long r = in.nextInt(); r in.nextInt() in.nextInt in long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for (long i = l; i <= Math.min(r, l + 2019) ; i++) {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        } long i = l; long i = l; i l i <= Math.min(r, l + 2019) i Math.min(r, l + 2019) Math.min Math r l + 2019 l 2019 i++ i++ i {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        } {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        } for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            } long j = l; long j = l; j l j <= Math.min(r, l + 2019) j Math.min(r, l + 2019) Math.min Math r l + 2019 l 2019 j++ j++ j {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            } {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            } if (i == j) continue; i == j i j continue; min = Math.min(min, (i * j) % 2019) min Math.min(min, (i * j) % 2019) Math.min Math min (i * j) % 2019 (i * j) i j 2019 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 in = new Scanner(System.in);
        long l = in.nextInt();
        long r = in.nextInt();

        long min = Long.MAX_VALUE;
        for (long i = l; i <= Math.min(r, l + 2019) ; i++) {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        }

        System.out.println(min);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long l = in.nextInt();
        long r = in.nextInt();

        long min = Long.MAX_VALUE;
        for (long i = l; i <= Math.min(r, l + 2019) ; i++) {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        }

        System.out.println(min);
    }
} Main
import java.util.Scanner;

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

        long min = Long.MAX_VALUE;
        for (long i = l; i <= Math.min(r, l + 2019) ; i++) {
            for (long j = l; j <= Math.min(r, l + 2019); j++) {
                if (i == j) continue;

                min = Math.min(min, (i * j) % 2019);
            }
        }

        System.out.println(min);
    }
}