import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();
        long ans = INF;
        if((R-L)>2019){
            System.out.println("0");
            return;
        }
        for (long i = L; i <= R; i++) {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        }
        System.out.println(ans);
    }

    int gcd(int m, int n) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
} import java.util.*; util.* java public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();
        long ans = INF;
        if((R-L)>2019){
            System.out.println("0");
            return;
        }
        for (long i = L; i <= R; i++) {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        }
        System.out.println(ans);
    }

    int gcd(int m, int n) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
} Main long INF = Long.MAX_VALUE; INF Long.MAX_VALUE Long Long.MAX_VALUE long[] dp; dp long n; n long S; S public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args void solve() {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();
        long ans = INF;
        if((R-L)>2019){
            System.out.println("0");
            return;
        }
        for (long i = L; i <= R; i++) {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        }
        System.out.println(ans);
    } solve {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();
        long ans = INF;
        if((R-L)>2019){
            System.out.println("0");
            return;
        }
        for (long i = L; i <= R; i++) {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = sc.nextLong(); L sc.nextLong() sc.nextLong sc long R = sc.nextLong(); R sc.nextLong() sc.nextLong sc long ans = INF; ans INF if((R-L)>2019){
            System.out.println("0");
            return;
        } (R-L)>2019 (R-L) R L 2019 {
            System.out.println("0");
            return;
        } System.out.println("0") System.out.println System.out System System.out "0" return; for (long i = L; i <= R; i++) {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        } long i = L; long i = L; i L i <= R i R i++ i++ i {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        } {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        } for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            } long j = i+1; long j = i+1; j i+1 i 1 j<=R j R j++ j++ j {
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            } {
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            } ans = Math.min(ans,(i*j)%2019) ans Math.min(ans,(i*j)%2019) Math.min Math ans (i*j)%2019 (i*j) i j 2019 if(ans == 0){
                    break;
                } ans == 0 ans 0 {
                    break;
                } break; System.out.println(ans) System.out.println System.out System System.out ans int gcd(int m, int n) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    } gcd {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    } if (m < n) {
            return gcd(n, m);
        } m < n m n {
            return gcd(n, m);
        } return gcd(n, m); gcd(n, m) gcd n m if (n == 0) {
            return m;
        } n == 0 n 0 {
            return m;
        } return m; m return gcd(n, m % n); gcd(n, m % n) gcd n m % n m n int m m int n n public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();
        long ans = INF;
        if((R-L)>2019){
            System.out.println("0");
            return;
        }
        for (long i = L; i <= R; i++) {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        }
        System.out.println(ans);
    }

    int gcd(int m, int n) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
} public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();
        long ans = INF;
        if((R-L)>2019){
            System.out.println("0");
            return;
        }
        for (long i = L; i <= R; i++) {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        }
        System.out.println(ans);
    }

    int gcd(int m, int n) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
} Main
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();
        long ans = INF;
        if((R-L)>2019){
            System.out.println("0");
            return;
        }
        for (long i = L; i <= R; i++) {
            for(long j = i+1;j<=R;j++){
                ans = Math.min(ans,(i*j)%2019);
                if(ans == 0){
                    break;
                }
            }
        }
        System.out.println(ans);
    }

    int gcd(int m, int n) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
}
