import 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();
        int result = 2018;
        loop: for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                result = Math.min(result, (int)((i * j) % 2019));
                if ((i * j) % 2019 == 0) {
                    break loop;
                }
            }
        }
        System.out.println(result);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int result = 2018;
        loop: for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                result = Math.min(result, (int)((i * j) % 2019));
                if ((i * j) % 2019 == 0) {
                    break loop;
                }
            }
        }
        System.out.println(result);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int result = 2018;
        loop: for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                result = Math.min(result, (int)((i * j) % 2019));
                if ((i * j) % 2019 == 0) {
                    break loop;
                }
            }
        }
        System.out.println(result);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int result = 2018;
        loop: for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                result = Math.min(result, (int)((i * j) % 2019));
                if ((i * j) % 2019 == 0) {
                    break loop;
                }
            }
        }
        System.out.println(result);
        sc.close();
    } 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 int result = 2018; result 2018 System.out.println(result) System.out.println System.out System System.out result sc.close() sc.close sc 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();
        int result = 2018;
        loop: for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                result = Math.min(result, (int)((i * j) % 2019));
                if ((i * j) % 2019 == 0) {
                    break loop;
                }
            }
        }
        System.out.println(result);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int result = 2018;
        loop: for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                result = Math.min(result, (int)((i * j) % 2019));
                if ((i * j) % 2019 == 0) {
                    break loop;
                }
            }
        }
        System.out.println(result);
        sc.close();
    }
} Main
import 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();
        int result = 2018;
        loop: for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                result = Math.min(result, (int)((i * j) % 2019));
                if ((i * j) % 2019 == 0) {
                    break loop;
                }
            }
        }
        System.out.println(result);
        sc.close();
    }
}