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();
        final int YEAR = 2019;
        
        if(L <= YEAR && R >= YEAR) {
            System.out.println(0);
        } else {
            long min = YEAR;
            for (int i = L; i < R; i++) {
                for (int j = i+1; j <= R; j++) {
                    long ijmod = ((long)i*j)%YEAR;
                    min = Math.min(min, ijmod);
                    if(ijmod == 0) {
                        i=R;
                        j = R;
                    }
                }
            }
            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();
        final int YEAR = 2019;
        
        if(L <= YEAR && R >= YEAR) {
            System.out.println(0);
        } else {
            long min = YEAR;
            for (int i = L; i < R; i++) {
                for (int j = i+1; j <= R; j++) {
                    long ijmod = ((long)i*j)%YEAR;
                    min = Math.min(min, ijmod);
                    if(ijmod == 0) {
                        i=R;
                        j = R;
                    }
                }
            }
            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();
        final int YEAR = 2019;
        
        if(L <= YEAR && R >= YEAR) {
            System.out.println(0);
        } else {
            long min = YEAR;
            for (int i = L; i < R; i++) {
                for (int j = i+1; j <= R; j++) {
                    long ijmod = ((long)i*j)%YEAR;
                    min = Math.min(min, ijmod);
                    if(ijmod == 0) {
                        i=R;
                        j = R;
                    }
                }
            }
            System.out.println(min);
        }

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

    }
}
