import java.util.*;

 class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long R = sc.nextLong();
        long ans = 9999;
        if (R-N>=2018) {
        	ans = 0;
        } else {
            N = N % 2019;
            R = R % 2019;
            if(N<R) {
            	long wk = 0;
            	for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	}
            }else {
            	ans = 0;
            }
        }
        
        System.out.println(ans);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long R = sc.nextLong();
        long ans = 9999;
        if (R-N>=2018) {
        	ans = 0;
        } else {
            N = N % 2019;
            R = R % 2019;
            if(N<R) {
            	long wk = 0;
            	for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	}
            }else {
            	ans = 0;
            }
        }
        
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long R = sc.nextLong();
        long ans = 9999;
        if (R-N>=2018) {
        	ans = 0;
        } else {
            N = N % 2019;
            R = R % 2019;
            if(N<R) {
            	long wk = 0;
            	for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	}
            }else {
            	ans = 0;
            }
        }
        
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long R = sc.nextLong();
        long ans = 9999;
        if (R-N>=2018) {
        	ans = 0;
        } else {
            N = N % 2019;
            R = R % 2019;
            if(N<R) {
            	long wk = 0;
            	for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	}
            }else {
            	ans = 0;
            }
        }
        
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long N = sc.nextLong(); N sc.nextLong() sc.nextLong sc long R = sc.nextLong(); R sc.nextLong() sc.nextLong sc long ans = 9999; ans 9999 if (R-N>=2018) {
        	ans = 0;
        } else {
            N = N % 2019;
            R = R % 2019;
            if(N<R) {
            	long wk = 0;
            	for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	}
            }else {
            	ans = 0;
            }
        } R-N>=2018 R-N R N 2018 {
        	ans = 0;
        } ans = 0 ans 0 {
            N = N % 2019;
            R = R % 2019;
            if(N<R) {
            	long wk = 0;
            	for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	}
            }else {
            	ans = 0;
            }
        } N = N % 2019 N N % 2019 N 2019 R = R % 2019 R R % 2019 R 2019 if(N<R) {
            	long wk = 0;
            	for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	}
            }else {
            	ans = 0;
            } N<R N R {
            	long wk = 0;
            	for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	}
            } long wk = 0; wk 0 for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	} long i=N; long i=N; i N i<=R i R i++ i++ i {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	} {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	} for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		} long j=i+1; long j=i+1; j i+1 i 1 j<=R j R j++ j++ j {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		} {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		} wk = i*j%2019 wk i*j%2019 i*j i j 2019 if(wk<ans) {
            				ans = wk;
            			} wk<ans wk ans {
            				ans = wk;
            			} ans = wk ans wk {
            	ans = 0;
            } ans = 0 ans 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

 class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long R = sc.nextLong();
        long ans = 9999;
        if (R-N>=2018) {
        	ans = 0;
        } else {
            N = N % 2019;
            R = R % 2019;
            if(N<R) {
            	long wk = 0;
            	for(long i=N; i<=R; i++) {
            		for(long j=i+1; j<=R; j++) {
            			wk = i*j%2019;
            			if(wk<ans) {
            				ans = wk;
            			}
            		}            		
            	}
            }else {
            	ans = 0;
            }
        }
        
        System.out.println(ans);
    }
}
