import java.util.Scanner;

public class Main {

    static final int MOD = 2019;

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

        long L = sc.nextInt();
        long R = sc.nextInt();

        R = Math.min(R, L + 2019); //Rを狭めても結果は一緒　2019を2週すれば同じmodが2個以上取れるのでi<jの場合も対応可能
        long ans = 2018;

        for (long i = L; i <= R; i++) {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        }

        System.out.println(ans);

    }

} import java.util.Scanner; Scanner java.util public class Main {

    static final int MOD = 2019;

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

        long L = sc.nextInt();
        long R = sc.nextInt();

        R = Math.min(R, L + 2019); //Rを狭めても結果は一緒　2019を2週すれば同じmodが2個以上取れるのでi<jの場合も対応可能
        long ans = 2018;

        for (long i = L; i <= R; i++) {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        }

        System.out.println(ans);

    }

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

        long L = sc.nextInt();
        long R = sc.nextInt();

        R = Math.min(R, L + 2019); //Rを狭めても結果は一緒　2019を2週すれば同じmodが2個以上取れるのでi<jの場合も対応可能
        long ans = 2018;

        for (long i = L; i <= R; i++) {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        }

        System.out.println(ans);

    } main {
        Scanner sc = new Scanner(System.in);

        long L = sc.nextInt();
        long R = sc.nextInt();

        R = Math.min(R, L + 2019); //Rを狭めても結果は一緒　2019を2週すれば同じmodが2個以上取れるのでi<jの場合も対応可能
        long ans = 2018;

        for (long i = L; i <= R; i++) {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        }

        System.out.println(ans);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = sc.nextInt(); L sc.nextInt() sc.nextInt sc long R = sc.nextInt(); R sc.nextInt() sc.nextInt sc R = Math.min(R, L + 2019) R Math.min(R, L + 2019) Math.min Math R L + 2019 L 2019 long ans = 2018; ans 2018 for (long i = L; i <= R; i++) {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        } long i = L; long i = L; i L i <= R i R i++ i++ i {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        } {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        } for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            } {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            } long x = i * j % 2019; x i * j % 2019 i * j i j 2019 ans = Math.min(ans, x) ans Math.min(ans, x) Math.min Math ans x System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    static final int MOD = 2019;

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

        long L = sc.nextInt();
        long R = sc.nextInt();

        R = Math.min(R, L + 2019); //Rを狭めても結果は一緒　2019を2週すれば同じmodが2個以上取れるのでi<jの場合も対応可能
        long ans = 2018;

        for (long i = L; i <= R; i++) {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        }

        System.out.println(ans);

    }

} public class Main {

    static final int MOD = 2019;

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

        long L = sc.nextInt();
        long R = sc.nextInt();

        R = Math.min(R, L + 2019); //Rを狭めても結果は一緒　2019を2週すれば同じmodが2個以上取れるのでi<jの場合も対応可能
        long ans = 2018;

        for (long i = L; i <= R; i++) {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        }

        System.out.println(ans);

    }

} Main
import java.util.Scanner;

public class Main {

    static final int MOD = 2019;

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

        long L = sc.nextInt();
        long R = sc.nextInt();

        R = Math.min(R, L + 2019); //Rを狭めても結果は一緒　2019を2週すれば同じmodが2個以上取れるのでi<jの場合も対応可能
        long ans = 2018;

        for (long i = L; i <= R; i++) {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        }

        System.out.println(ans);

    }

}
