import java.util.Scanner;

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

        int min = 10000;


        if(r - l < 2019){
            if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            }
        } else {
            min = 0;
        }

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

        int min = 10000;


        if(r - l < 2019){
            if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            }
        } else {
            min = 0;
        }

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

        int min = 10000;


        if(r - l < 2019){
            if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            }
        } else {
            min = 0;
        }

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

        int min = 10000;


        if(r - l < 2019){
            if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            }
        } else {
            min = 0;
        }

        System.out.println(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l = sc.nextInt(); l sc.nextInt() sc.nextInt sc int r = sc.nextInt(); r sc.nextInt() sc.nextInt sc int min = 10000; min 10000 if(r - l < 2019){
            if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            }
        } else {
            min = 0;
        } r - l < 2019 r - l r l 2019 {
            if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            }
        } if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            } l%2019 > r%2019 l%2019 l 2019 r%2019 r 2019 {
                min = 0;
            } min = 0 min 0 {
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            } for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                } int i = l; int i = l; i l i < r i r i++ i++ i {
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                } {
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                } for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    } int j = i+1; int j = i+1; j i+1 i 1 j <= r j r j++ j++ j {
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    } {
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    } min = Math.min(min, (i%2019)*(j%2019) % 2019) min Math.min(min, (i%2019)*(j%2019) % 2019) Math.min Math min (i%2019)*(j%2019) % 2019 (i%2019)*(j%2019) (i%2019) i 2019 (j%2019) j 2019 2019 if(min == 0) break; min == 0 min 0 break; {
            min = 0;
        } min = 0 min 0 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 sc = new Scanner(System.in);
        
        int l = sc.nextInt();
        int r = sc.nextInt();

        int min = 10000;


        if(r - l < 2019){
            if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            }
        } else {
            min = 0;
        }

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

        int min = 10000;


        if(r - l < 2019){
            if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            }
        } else {
            min = 0;
        }

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

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

        int min = 10000;


        if(r - l < 2019){
            if(l%2019 > r%2019) {
                min = 0;
            } else{
                for(int i = l; i < r; i++){
                    for(int j = i+1; j <= r; j++){
                        min = Math.min(min, (i%2019)*(j%2019) % 2019);
                        if(min == 0) break;
                    }
                }
            }
        } else {
            min = 0;
        }

        System.out.println(min);
    }
}