import java.util.*;

public class Main {

    static int mod = 2019;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long lmod = l % mod;
        long diff = r - l;
        if(2019 <= lmod + diff) System.out.println(0);
        else{
            long ans = 2019;
            for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            }
            System.out.println(ans);
        }
        sc.close();

    }

} import java.util.*; util.* java public class Main {

    static int mod = 2019;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long lmod = l % mod;
        long diff = r - l;
        if(2019 <= lmod + diff) System.out.println(0);
        else{
            long ans = 2019;
            for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            }
            System.out.println(ans);
        }
        sc.close();

    }

} Main static int mod = 2019; mod 2019 public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long lmod = l % mod;
        long diff = r - l;
        if(2019 <= lmod + diff) System.out.println(0);
        else{
            long ans = 2019;
            for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            }
            System.out.println(ans);
        }
        sc.close();

    } main {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long lmod = l % mod;
        long diff = r - l;
        if(2019 <= lmod + diff) System.out.println(0);
        else{
            long ans = 2019;
            for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            }
            System.out.println(ans);
        }
        sc.close();

    } 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 lmod = l % mod; lmod l % mod l mod long diff = r - l; diff r - l r l if(2019 <= lmod + diff) System.out.println(0);
        else{
            long ans = 2019;
            for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            }
            System.out.println(ans);
        } 2019 <= lmod + diff 2019 lmod + diff lmod diff System.out.println(0) System.out.println System.out System System.out 0 {
            long ans = 2019;
            for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            }
            System.out.println(ans);
        } long ans = 2019; ans 2019 for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            } 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 % mod);
                }
            } {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            } for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                } 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 % mod);
                } {
                    ans = Math.min(ans, i * j % mod);
                } ans = Math.min(ans, i * j % mod) ans Math.min(ans, i * j % mod) Math.min Math ans i * j % mod i * j i j mod System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

    static int mod = 2019;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long lmod = l % mod;
        long diff = r - l;
        if(2019 <= lmod + diff) System.out.println(0);
        else{
            long ans = 2019;
            for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            }
            System.out.println(ans);
        }
        sc.close();

    }

} public class Main {

    static int mod = 2019;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long lmod = l % mod;
        long diff = r - l;
        if(2019 <= lmod + diff) System.out.println(0);
        else{
            long ans = 2019;
            for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            }
            System.out.println(ans);
        }
        sc.close();

    }

} Main
import java.util.*;

public class Main {

    static int mod = 2019;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long lmod = l % mod;
        long diff = r - l;
        if(2019 <= lmod + diff) System.out.println(0);
        else{
            long ans = 2019;
            for (long i = l; i < r; i++) {
                for (long j = i+1; j <= r; j++) {
                    ans = Math.min(ans, i * j % mod);
                }
            }
            System.out.println(ans);
        }
        sc.close();

    }

}
