import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();
        long gap = Math.min((r - l), 2018);
        l %= 2019;
        r %= 2019;
        
        long ans = 2019;

        if (r <= l) {
            ans = 0;
        } else {
            for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            }
        }

        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();
        long gap = Math.min((r - l), 2018);
        l %= 2019;
        r %= 2019;
        
        long ans = 2019;

        if (r <= l) {
            ans = 0;
        } else {
            for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            }
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();
        long gap = Math.min((r - l), 2018);
        l %= 2019;
        r %= 2019;
        
        long ans = 2019;

        if (r <= l) {
            ans = 0;
        } else {
            for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            }
        }

        System.out.println(ans);
    } main {
        // write your code here
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();
        long gap = Math.min((r - l), 2018);
        l %= 2019;
        r %= 2019;
        
        long ans = 2019;

        if (r <= l) {
            ans = 0;
        } else {
            for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            }
        }

        System.out.println(ans);
    } 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 gap = Math.min((r - l), 2018); gap Math.min((r - l), 2018) Math.min Math (r - l) r l 2018 l %= 2019 l 2019 r %= 2019 r 2019 long ans = 2019; ans 2019 if (r <= l) {
            ans = 0;
        } else {
            for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            }
        } r <= l r l {
            ans = 0;
        } ans = 0 ans 0 {
            for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            }
        } for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            } long i = l; long i = l; i l i < l + gap i l + gap l gap i++ i++ i {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            } {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            } for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= l + gap j l + gap l gap j++ j++ j {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                } {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                } long value = i * j % 2019; value i * j % 2019 i * j i j 2019 ans = Math.min(ans, value) ans Math.min(ans, value) Math.min Math ans value if (ans == 0) {
                        break;
                    } ans == 0 ans 0 {
                        break;
                    } break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();
        long gap = Math.min((r - l), 2018);
        l %= 2019;
        r %= 2019;
        
        long ans = 2019;

        if (r <= l) {
            ans = 0;
        } else {
            for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            }
        }

        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();
        long gap = Math.min((r - l), 2018);
        l %= 2019;
        r %= 2019;
        
        long ans = 2019;

        if (r <= l) {
            ans = 0;
        } else {
            for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            }
        }

        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        long l = sc.nextLong();
        long r = sc.nextLong();
        long gap = Math.min((r - l), 2018);
        l %= 2019;
        r %= 2019;
        
        long ans = 2019;

        if (r <= l) {
            ans = 0;
        } else {
            for (long i = l; i < l + gap; i++) {
                for (long j = i + 1; j <= l + gap; j++) {
                    long value = i * j % 2019;
                    ans = Math.min(ans, value);
                    if (ans == 0) {
                        break;
                    }
                }
            }
        }

        System.out.println(ans);
    }
}