import 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();
        if(r-l>=2019){System.out.println(0);}
        else{l%=2019;
        r%=2019;
        if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);}
            }
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
        if(r-l>=2019){System.out.println(0);}
        else{l%=2019;
        r%=2019;
        if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);}
            }
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
        if(r-l>=2019){System.out.println(0);}
        else{l%=2019;
        r%=2019;
        if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);}
            }
	} main {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
        if(r-l>=2019){System.out.println(0);}
        else{l%=2019;
        r%=2019;
        if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);}
            }
	} 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 if(r-l>=2019){System.out.println(0);}
        else{l%=2019;
        r%=2019;
        if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);}
            } r-l>=2019 r-l r l 2019 {System.out.println(0);} System.out.println(0) System.out.println System.out System System.out 0 {l%=2019;
        r%=2019;
        if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);}
            } l%=2019 l 2019 r%=2019 r 2019 if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);} l<r l r {int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);} int ans = 2019; ans 2019 for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    } int i=l; int i=l; i l i<r i r i++ i++ i {for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    } {for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    } for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);} int j=i+1; int j=i+1; j i+1 i 1 j<=r j r 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 {System.out.println(0);} System.out.println(0) System.out.println System.out System System.out 0 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();
        if(r-l>=2019){System.out.println(0);}
        else{l%=2019;
        r%=2019;
        if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);}
            }
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
        if(r-l>=2019){System.out.println(0);}
        else{l%=2019;
        r%=2019;
        if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);}
            }
	}
} Main
import 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();
        if(r-l>=2019){System.out.println(0);}
        else{l%=2019;
        r%=2019;
        if(l<r){int ans = 2019;
                for(int i=l;i<r;i++){for(int j=i+1;j<=r;j++)
                {ans = Math.min(ans,(i*j)%2019);}
                                    }
                System.out.println(ans);}
		else{System.out.println(0);}
            }
	}
}
