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

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scan.nextLong();
        long R = scan.nextLong();
        if (2018 < R - L) {
            System.out.println(0);
            return;
        }
        long answer = Integer.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        }
        System.out.println(answer);
    }
} 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) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scan.nextLong();
        long R = scan.nextLong();
        if (2018 < R - L) {
            System.out.println(0);
            return;
        }
        long answer = Integer.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        }
        System.out.println(answer);
    }
} Main public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    } main {
        Main main = new Main();
        main.solve();
    } Main main = new Main(); main new Main() main.solve() main.solve main String[] args args public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scan.nextLong();
        long R = scan.nextLong();
        if (2018 < R - L) {
            System.out.println(0);
            return;
        }
        long answer = Integer.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        }
        System.out.println(answer);
    } solve {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scan.nextLong();
        long R = scan.nextLong();
        if (2018 < R - L) {
            System.out.println(0);
            return;
        }
        long answer = Integer.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        }
        System.out.println(answer);
    } Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scan new Scanner(new BufferedReader(new InputStreamReader(System.in))) long L = scan.nextLong(); L scan.nextLong() scan.nextLong scan long R = scan.nextLong(); R scan.nextLong() scan.nextLong scan if (2018 < R - L) {
            System.out.println(0);
            return;
        } 2018 < R - L 2018 R - L R L {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; long answer = Integer.MAX_VALUE; answer Integer.MAX_VALUE Integer Integer.MAX_VALUE for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        } long i = L; long i = L; i L i < R i R i++ i++ i {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        } {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        } for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                answer = Math.min(answer, (i * j) % 2019);
            } {
                answer = Math.min(answer, (i * j) % 2019);
            } answer = Math.min(answer, (i * j) % 2019) answer Math.min(answer, (i * j) % 2019) Math.min Math answer (i * j) % 2019 (i * j) i j 2019 System.out.println(answer) System.out.println System.out System System.out answer public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scan.nextLong();
        long R = scan.nextLong();
        if (2018 < R - L) {
            System.out.println(0);
            return;
        }
        long answer = Integer.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        }
        System.out.println(answer);
    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scan.nextLong();
        long R = scan.nextLong();
        if (2018 < R - L) {
            System.out.println(0);
            return;
        }
        long answer = Integer.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        }
        System.out.println(answer);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scan.nextLong();
        long R = scan.nextLong();
        if (2018 < R - L) {
            System.out.println(0);
            return;
        }
        long answer = Integer.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                answer = Math.min(answer, (i * j) % 2019);
            }
        }
        System.out.println(answer);
    }
}
