import java.math.BigDecimal;
import java.util.*;

public class Main {


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

        String s = sc.nextLine();
        long l = Long.parseLong(s.split(" ")[0]);
        long r = Long.parseLong(s.split(" ")[1]);

        long ans = 10000;
        for(long i = l; i <= Math.min(r, l + 2018); i++){
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        }

        System.out.println(ans);
        return;
    }
} import java.math.BigDecimal; BigDecimal java.math import java.util.*; util.* java public class Main {


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

        String s = sc.nextLine();
        long l = Long.parseLong(s.split(" ")[0]);
        long r = Long.parseLong(s.split(" ")[1]);

        long ans = 10000;
        for(long i = l; i <= Math.min(r, l + 2018); i++){
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        }

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

        String s = sc.nextLine();
        long l = Long.parseLong(s.split(" ")[0]);
        long r = Long.parseLong(s.split(" ")[1]);

        long ans = 10000;
        for(long i = l; i <= Math.min(r, l + 2018); i++){
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        }

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

        String s = sc.nextLine();
        long l = Long.parseLong(s.split(" ")[0]);
        long r = Long.parseLong(s.split(" ")[1]);

        long ans = 10000;
        for(long i = l; i <= Math.min(r, l + 2018); i++){
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        }

        System.out.println(ans);
        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc long l = Long.parseLong(s.split(" ")[0]); l Long.parseLong(s.split(" ")[0]) Long.parseLong Long s.split(" ")[0] s.split(" ") s.split s " " 0 long r = Long.parseLong(s.split(" ")[1]); r Long.parseLong(s.split(" ")[1]) Long.parseLong Long s.split(" ")[1] s.split(" ") s.split s " " 1 long ans = 10000; ans 10000 for(long i = l; i <= Math.min(r, l + 2018); i++){
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        } long i = l; long i = l; i l i <= Math.min(r, l + 2018) i Math.min(r, l + 2018) Math.min Math r l + 2018 l 2018 i++ i++ i {
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        } {
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        } for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= Math.min(r, l + 2018) j Math.min(r, l + 2018) Math.min Math r l + 2018 l 2018 j++ j++ j {
                ans = Math.min(ans, i * j % 2019);
            } {
                ans = Math.min(ans, i * j % 2019);
            } 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 return; String[] args args public class Main {


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

        String s = sc.nextLine();
        long l = Long.parseLong(s.split(" ")[0]);
        long r = Long.parseLong(s.split(" ")[1]);

        long ans = 10000;
        for(long i = l; i <= Math.min(r, l + 2018); i++){
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        }

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


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

        String s = sc.nextLine();
        long l = Long.parseLong(s.split(" ")[0]);
        long r = Long.parseLong(s.split(" ")[1]);

        long ans = 10000;
        for(long i = l; i <= Math.min(r, l + 2018); i++){
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        }

        System.out.println(ans);
        return;
    }
} Main
import java.math.BigDecimal;
import java.util.*;

public class Main {


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

        String s = sc.nextLine();
        long l = Long.parseLong(s.split(" ")[0]);
        long r = Long.parseLong(s.split(" ")[1]);

        long ans = 10000;
        for(long i = l; i <= Math.min(r, l + 2018); i++){
            for(long j = i + 1; j <= Math.min(r, l + 2018); j++){
                ans = Math.min(ans, i * j % 2019);
            }
        }

        System.out.println(ans);
        return;
    }
}
