import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = sc.nextInt();
        long R = sc.nextInt();

        if ((R - L) >= 2019) {
            System.out.println(0);
        }
        else {
            long res = 2019;
            for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            }
            System.out.println(res);
        }

    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = sc.nextInt();
        long R = sc.nextInt();

        if ((R - L) >= 2019) {
            System.out.println(0);
        }
        else {
            long res = 2019;
            for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            }
            System.out.println(res);
        }

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = sc.nextInt();
        long R = sc.nextInt();

        if ((R - L) >= 2019) {
            System.out.println(0);
        }
        else {
            long res = 2019;
            for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            }
            System.out.println(res);
        }

    } main {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = sc.nextInt();
        long R = sc.nextInt();

        if ((R - L) >= 2019) {
            System.out.println(0);
        }
        else {
            long res = 2019;
            for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            }
            System.out.println(res);
        }

    } Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); sc new Scanner(new BufferedReader(new InputStreamReader(System.in))) long L = sc.nextInt(); L sc.nextInt() sc.nextInt sc long R = sc.nextInt(); R sc.nextInt() sc.nextInt sc if ((R - L) >= 2019) {
            System.out.println(0);
        }
        else {
            long res = 2019;
            for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            }
            System.out.println(res);
        } (R - L) >= 2019 (R - L) R L 2019 {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 {
            long res = 2019;
            for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            }
            System.out.println(res);
        } long res = 2019; res 2019 for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            } long i = L; long i = L; i L i <= R i R i++ i++ i {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            } {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            } for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                } {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                } long temp = (i * j) % 2019; temp (i * j) % 2019 (i * j) i j 2019 res = Math.min(res , temp) res Math.min(res , temp) Math.min Math res temp System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = sc.nextInt();
        long R = sc.nextInt();

        if ((R - L) >= 2019) {
            System.out.println(0);
        }
        else {
            long res = 2019;
            for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            }
            System.out.println(res);
        }

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = sc.nextInt();
        long R = sc.nextInt();

        if ((R - L) >= 2019) {
            System.out.println(0);
        }
        else {
            long res = 2019;
            for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            }
            System.out.println(res);
        }

    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = sc.nextInt();
        long R = sc.nextInt();

        if ((R - L) >= 2019) {
            System.out.println(0);
        }
        else {
            long res = 2019;
            for(long i = L; i <= R; i++) {
                for(long j = i + 1; j <= R; j++ ) {
                    long temp = (i * j) % 2019;
                    res = Math.min(res , temp);

                }
            }
            System.out.println(res);
        }

    }
}
