import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int num = 2019;
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        if (l + 2020 <= r) {
            System.out.println(0);
        }
        else {
            for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            }
            System.out.println(num);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        int num = 2019;
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        if (l + 2020 <= r) {
            System.out.println(0);
        }
        else {
            for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            }
            System.out.println(num);
        }
    }
} Main public static void main(String[] args) {
        int num = 2019;
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        if (l + 2020 <= r) {
            System.out.println(0);
        }
        else {
            for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            }
            System.out.println(num);
        }
    } main {
        int num = 2019;
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        if (l + 2020 <= r) {
            System.out.println(0);
        }
        else {
            for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            }
            System.out.println(num);
        }
    } int num = 2019; num 2019 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 if (l + 2020 <= r) {
            System.out.println(0);
        }
        else {
            for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            }
            System.out.println(num);
        } l + 2020 <= r l + 2020 l 2020 r {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 {
            for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            }
            System.out.println(num);
        } for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            } int i = l; int i = l; i l i <= r i r i++ i++ i {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            } {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            } for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                } int j = i+1; int j = i+1; j i+1 i 1 j <= r j r j++ j++ j {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                } {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                } int x = i % 2019; x i % 2019 i 2019 int y = j % 2019; y j % 2019 j 2019 int z = x*y; z x*y x y num = Math.min(num, z % 2019) num Math.min(num, z % 2019) Math.min Math num z % 2019 z 2019 System.out.println(num) System.out.println System.out System System.out num String[] args args public class Main {

    public static void main(String[] args) {
        int num = 2019;
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        if (l + 2020 <= r) {
            System.out.println(0);
        }
        else {
            for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            }
            System.out.println(num);
        }
    }
} public class Main {

    public static void main(String[] args) {
        int num = 2019;
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        if (l + 2020 <= r) {
            System.out.println(0);
        }
        else {
            for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            }
            System.out.println(num);
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int num = 2019;
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        if (l + 2020 <= r) {
            System.out.println(0);
        }
        else {
            for (int i = l; i <= r; i++) {
                for (int j = i+1; j <= r; j++) {
                    int x = i % 2019;
                    int y = j % 2019;
                    int z = x*y;
                    num = Math.min(num, z % 2019);
                }
            }
            System.out.println(num);
        }
    }
}