import java.util.*;

public class Main {

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

        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long N = 2019 *3;

        N = Math.min(L + N, R);

        ArrayList<Long> mods = new ArrayList<>();

        for(long i=L; i<=N; i++){
            mods.add(i % 2019L);
        }

        Collections.sort(mods);

        long ans = Long.MAX_VALUE;

        N = mods.size();

        for(int i=0; i<N-1; i++){
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        }


        System.out.println(ans);

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

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

        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long N = 2019 *3;

        N = Math.min(L + N, R);

        ArrayList<Long> mods = new ArrayList<>();

        for(long i=L; i<=N; i++){
            mods.add(i % 2019L);
        }

        Collections.sort(mods);

        long ans = Long.MAX_VALUE;

        N = mods.size();

        for(int i=0; i<N-1; i++){
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        }


        System.out.println(ans);

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

        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long N = 2019 *3;

        N = Math.min(L + N, R);

        ArrayList<Long> mods = new ArrayList<>();

        for(long i=L; i<=N; i++){
            mods.add(i % 2019L);
        }

        Collections.sort(mods);

        long ans = Long.MAX_VALUE;

        N = mods.size();

        for(int i=0; i<N-1; i++){
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        }


        System.out.println(ans);

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

        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long N = 2019 *3;

        N = Math.min(L + N, R);

        ArrayList<Long> mods = new ArrayList<>();

        for(long i=L; i<=N; i++){
            mods.add(i % 2019L);
        }

        Collections.sort(mods);

        long ans = Long.MAX_VALUE;

        N = mods.size();

        for(int i=0; i<N-1; i++){
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        }


        System.out.println(ans);

    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) long L = scanner.nextLong(); L scanner.nextLong() scanner.nextLong scanner long R = scanner.nextLong(); R scanner.nextLong() scanner.nextLong scanner long N = 2019 *3; N 2019 *3 2019 3 N = Math.min(L + N, R) N Math.min(L + N, R) Math.min Math L + N L N R ArrayList<Long> mods = new ArrayList<>(); mods new ArrayList<>() for(long i=L; i<=N; i++){
            mods.add(i % 2019L);
        } long i=L; long i=L; i L i<=N i N i++ i++ i {
            mods.add(i % 2019L);
        } {
            mods.add(i % 2019L);
        } mods.add(i % 2019L) mods.add mods i % 2019L i 2019L Collections.sort(mods) Collections.sort Collections mods long ans = Long.MAX_VALUE; ans Long.MAX_VALUE Long Long.MAX_VALUE N = mods.size() N mods.size() mods.size mods for(int i=0; i<N-1; i++){
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        } int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        } {
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        } for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            } int j=i+1; int j=i+1; j i+1 i 1 j<N j N j++ j++ j {
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            } {
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            } ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019) ans Math.min(ans, (mods.get(i) * mods.get(j)) % 2019) Math.min Math ans (mods.get(i) * mods.get(j)) % 2019 (mods.get(i) * mods.get(j)) mods.get(i) mods.get mods i mods.get(j) mods.get mods 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) {
        Scanner scanner = new Scanner(System.in);

        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long N = 2019 *3;

        N = Math.min(L + N, R);

        ArrayList<Long> mods = new ArrayList<>();

        for(long i=L; i<=N; i++){
            mods.add(i % 2019L);
        }

        Collections.sort(mods);

        long ans = Long.MAX_VALUE;

        N = mods.size();

        for(int i=0; i<N-1; i++){
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        }


        System.out.println(ans);

    }
} public class Main {

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

        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long N = 2019 *3;

        N = Math.min(L + N, R);

        ArrayList<Long> mods = new ArrayList<>();

        for(long i=L; i<=N; i++){
            mods.add(i % 2019L);
        }

        Collections.sort(mods);

        long ans = Long.MAX_VALUE;

        N = mods.size();

        for(int i=0; i<N-1; i++){
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        }


        System.out.println(ans);

    }
} Main
import java.util.*;

public class Main {

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

        long L = scanner.nextLong();
        long R = scanner.nextLong();

        long N = 2019 *3;

        N = Math.min(L + N, R);

        ArrayList<Long> mods = new ArrayList<>();

        for(long i=L; i<=N; i++){
            mods.add(i % 2019L);
        }

        Collections.sort(mods);

        long ans = Long.MAX_VALUE;

        N = mods.size();

        for(int i=0; i<N-1; i++){
            for(int j=i+1; j<N; j++){
                ans = Math.min(ans, (mods.get(i) * mods.get(j)) % 2019);
            }
        }


        System.out.println(ans);

    }
}