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();

        if (l >= 2019) {
            int minus = 2019 * (l / 2019);
            l -= minus;
            r -= minus;
        }

        if (r > 2019) {
            r = 2019;
        }

        int result = 2018;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        }

        System.out.println(result);
    }
} 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();

        if (l >= 2019) {
            int minus = 2019 * (l / 2019);
            l -= minus;
            r -= minus;
        }

        if (r > 2019) {
            r = 2019;
        }

        int result = 2018;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        }

        System.out.println(result);
    }
} Main public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();

        if (l >= 2019) {
            int minus = 2019 * (l / 2019);
            l -= minus;
            r -= minus;
        }

        if (r > 2019) {
            r = 2019;
        }

        int result = 2018;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        }

        System.out.println(result);
    } main {

        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();

        if (l >= 2019) {
            int minus = 2019 * (l / 2019);
            l -= minus;
            r -= minus;
        }

        if (r > 2019) {
            r = 2019;
        }

        int result = 2018;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        }

        System.out.println(result);
    } 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 >= 2019) {
            int minus = 2019 * (l / 2019);
            l -= minus;
            r -= minus;
        } l >= 2019 l 2019 {
            int minus = 2019 * (l / 2019);
            l -= minus;
            r -= minus;
        } int minus = 2019 * (l / 2019); minus 2019 * (l / 2019) 2019 (l / 2019) l 2019 l -= minus l minus r -= minus r minus if (r > 2019) {
            r = 2019;
        } r > 2019 r 2019 {
            r = 2019;
        } r = 2019 r 2019 int result = 2018; result 2018 for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        } int i = l; int i = l; i l i < r i r i++ i++ i {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        } {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        } for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            } int j = l + 1; int j = l + 1; j l + 1 l 1 j <= r j r j++ j++ j {
                result = Math.min(result, i * j % 2019);
            } {
                result = Math.min(result, i * j % 2019);
            } result = Math.min(result, i * j % 2019) result Math.min(result, i * j % 2019) Math.min Math result i * j % 2019 i * j i j 2019 System.out.println(result) System.out.println System.out System System.out result 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();

        if (l >= 2019) {
            int minus = 2019 * (l / 2019);
            l -= minus;
            r -= minus;
        }

        if (r > 2019) {
            r = 2019;
        }

        int result = 2018;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        }

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

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();

        if (l >= 2019) {
            int minus = 2019 * (l / 2019);
            l -= minus;
            r -= minus;
        }

        if (r > 2019) {
            r = 2019;
        }

        int result = 2018;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        }

        System.out.println(result);
    }
} 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();

        if (l >= 2019) {
            int minus = 2019 * (l / 2019);
            l -= minus;
            r -= minus;
        }

        if (r > 2019) {
            r = 2019;
        }

        int result = 2018;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                result = Math.min(result, i * j % 2019);
            }
        }

        System.out.println(result);
    }
}
