import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long L = Integer.parseInt(sc.next());
        long R = Integer.parseInt(sc.next());
        
        if(L % 2019 == 0) {
            System.out.println(0);
        }else if(R - L >= 2019) {
            System.out.println(0);
        }else {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            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);
        long L = Integer.parseInt(sc.next());
        long R = Integer.parseInt(sc.next());
        
        if(L % 2019 == 0) {
            System.out.println(0);
        }else if(R - L >= 2019) {
            System.out.println(0);
        }else {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            }
            
            System.out.println(min);
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long L = Integer.parseInt(sc.next());
        long R = Integer.parseInt(sc.next());
        
        if(L % 2019 == 0) {
            System.out.println(0);
        }else if(R - L >= 2019) {
            System.out.println(0);
        }else {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            }
            
            System.out.println(min);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        long L = Integer.parseInt(sc.next());
        long R = Integer.parseInt(sc.next());
        
        if(L % 2019 == 0) {
            System.out.println(0);
        }else if(R - L >= 2019) {
            System.out.println(0);
        }else {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            }
            
            System.out.println(min);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = Integer.parseInt(sc.next()); L Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long R = Integer.parseInt(sc.next()); R Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if(L % 2019 == 0) {
            System.out.println(0);
        }else if(R - L >= 2019) {
            System.out.println(0);
        }else {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            }
            
            System.out.println(min);
        } L % 2019 == 0 L % 2019 L 2019 0 {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 if(R - L >= 2019) {
            System.out.println(0);
        }else {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            }
            
            System.out.println(min);
        } 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 {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            }
            
            System.out.println(min);
        } long min = 2018; min 2018 for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            } long i = L; long i = L; i L i < R i R i++ i++ i {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            } {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            } for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                } long j = L+1; long j = L+1; j L+1 L 1 j <= R j R j++ j++ j {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                } {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                } if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    } (i%2019)*(j%2019) % 2019 == 0 (i%2019)*(j%2019) % 2019 (i%2019)*(j%2019) (i%2019) i 2019 (j%2019) j 2019 2019 0 {
                        min = 0;
                        break;
                    } min = 0 min 0 break; {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    } if(min > (i%2019)*(j%2019) % 2019) {
                            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 {
                            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);
        long L = Integer.parseInt(sc.next());
        long R = Integer.parseInt(sc.next());
        
        if(L % 2019 == 0) {
            System.out.println(0);
        }else if(R - L >= 2019) {
            System.out.println(0);
        }else {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            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);
        long L = Integer.parseInt(sc.next());
        long R = Integer.parseInt(sc.next());
        
        if(L % 2019 == 0) {
            System.out.println(0);
        }else if(R - L >= 2019) {
            System.out.println(0);
        }else {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            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);
        long L = Integer.parseInt(sc.next());
        long R = Integer.parseInt(sc.next());
        
        if(L % 2019 == 0) {
            System.out.println(0);
        }else if(R - L >= 2019) {
            System.out.println(0);
        }else {
            long min = 2018;
            for(long i = L; i < R; i++) {
                for(long j = L+1; j <= R; j++) {
                    if((i%2019)*(j%2019) % 2019 == 0) {
                        min = 0;
                        break;
                    }else {
                        if(min > (i%2019)*(j%2019) % 2019) {
                            min = (i%2019)*(j%2019) % 2019;
                        }
                    }
                }
            }
            
            System.out.println(min);
        }
    }
}