import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final long l = sc.nextLong();
        final long r = sc.nextLong();

        long ans = Long.MAX_VALUE;

        if (r - l >= 2020) {
            ans = 0;
        } else {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        }

        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final long l = sc.nextLong();
        final long r = sc.nextLong();

        long ans = Long.MAX_VALUE;

        if (r - l >= 2020) {
            ans = 0;
        } else {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final long l = sc.nextLong();
        final long r = sc.nextLong();

        long ans = Long.MAX_VALUE;

        if (r - l >= 2020) {
            ans = 0;
        } else {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        }

        System.out.println(ans);
    } main {
        final Scanner sc = new Scanner(System.in);

        final long l = sc.nextLong();
        final long r = sc.nextLong();

        long ans = Long.MAX_VALUE;

        if (r - l >= 2020) {
            ans = 0;
        } else {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        }

        System.out.println(ans);
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc final long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc long ans = Long.MAX_VALUE; ans Long.MAX_VALUE Long Long.MAX_VALUE if (r - l >= 2020) {
            ans = 0;
        } else {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        } r - l >= 2020 r - l r l 2020 {
            ans = 0;
        } ans = 0 ans 0 {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        } for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            } long i = l; long i = l; i l i <= r i r i++ i++ i {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            } {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            } for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                } long j = l; long j = l; j l j <= r j r j++ j++ j {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                } {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                } if (i == j) continue; i == j i j continue; ans = Math.min(ans, (i*j) % 2019) ans Math.min(ans, (i*j) % 2019) Math.min Math ans (i*j) % 2019 (i*j) i j 2019 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) {
        final Scanner sc = new Scanner(System.in);

        final long l = sc.nextLong();
        final long r = sc.nextLong();

        long ans = Long.MAX_VALUE;

        if (r - l >= 2020) {
            ans = 0;
        } else {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        }

        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final long l = sc.nextLong();
        final long r = sc.nextLong();

        long ans = Long.MAX_VALUE;

        if (r - l >= 2020) {
            ans = 0;
        } else {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        }

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

public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final long l = sc.nextLong();
        final long r = sc.nextLong();

        long ans = Long.MAX_VALUE;

        if (r - l >= 2020) {
            ans = 0;
        } else {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        }

        System.out.println(ans);
    }
}
