import java.util.*;

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