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();
		int min = (L%2019)*(R%2019)%2019;
		if (R-L > 2019){
		    System.out.println(0);
		    return;
		}
		for(int i=L;i<R;i++){
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		}
		System.out.println(min);
	}
} 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();
		int min = (L%2019)*(R%2019)%2019;
		if (R-L > 2019){
		    System.out.println(0);
		    return;
		}
		for(int i=L;i<R;i++){
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		}
		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 = (L%2019)*(R%2019)%2019;
		if (R-L > 2019){
		    System.out.println(0);
		    return;
		}
		for(int i=L;i<R;i++){
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		}
		System.out.println(min);
	} main {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int min = (L%2019)*(R%2019)%2019;
		if (R-L > 2019){
		    System.out.println(0);
		    return;
		}
		for(int i=L;i<R;i++){
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		}
		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 = (L%2019)*(R%2019)%2019; min (L%2019)*(R%2019)%2019 (L%2019)*(R%2019) (L%2019) L 2019 (R%2019) R 2019 2019 if (R-L > 2019){
		    System.out.println(0);
		    return;
		} R-L > 2019 R-L R L 2019 {
		    System.out.println(0);
		    return;
		} System.out.println(0) System.out.println System.out System System.out 0 return; for(int i=L;i<R;i++){
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		} int i=L; int i=L; i L i<R i R i++ i++ i {
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		} {
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		} for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    } int j=i+1; int j=i+1; j i+1 i 1 j<=R j R j++ j++ j {
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    } {
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    } if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        } (i%2019)*(j%2019)%2019 < min (i%2019)*(j%2019)%2019 (i%2019)*(j%2019) (i%2019) i 2019 (j%2019) j 2019 2019 min {
		            min = (i%2019)*(j%2019)%2019;
		        } min = (i%2019)*(j%2019)%2019 min (i%2019)*(j%2019)%2019 (i%2019)*(j%2019) (i%2019) i 2019 (j%2019) j 2019 2019 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 = (L%2019)*(R%2019)%2019;
		if (R-L > 2019){
		    System.out.println(0);
		    return;
		}
		for(int i=L;i<R;i++){
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		}
		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 = (L%2019)*(R%2019)%2019;
		if (R-L > 2019){
		    System.out.println(0);
		    return;
		}
		for(int i=L;i<R;i++){
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		}
		System.out.println(min);
	}
} 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();
		int min = (L%2019)*(R%2019)%2019;
		if (R-L > 2019){
		    System.out.println(0);
		    return;
		}
		for(int i=L;i<R;i++){
		    for(int j=i+1;j<=R;j++){
		        if((i%2019)*(j%2019)%2019 < min){
		            min = (i%2019)*(j%2019)%2019;
		        }
		    }
		}
		System.out.println(min);
	}
}