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();
        long mod=0;

        int l = L%2019;
        int r = R%2019;
        int l1 = L/2019;
        int r1 = R/2019;

        if(R-L +1 >=2019){//large enough to contain 2019 multiples
            mod =0;
        }else if(l==0 || r ==0){//contain 2019 multiple at edge
            mod = 0;
        }else if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        }



        System.out.println(mod);

    }

} 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();
        long mod=0;

        int l = L%2019;
        int r = R%2019;
        int l1 = L/2019;
        int r1 = R/2019;

        if(R-L +1 >=2019){//large enough to contain 2019 multiples
            mod =0;
        }else if(l==0 || r ==0){//contain 2019 multiple at edge
            mod = 0;
        }else if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        }



        System.out.println(mod);

    }

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

        int l = L%2019;
        int r = R%2019;
        int l1 = L/2019;
        int r1 = R/2019;

        if(R-L +1 >=2019){//large enough to contain 2019 multiples
            mod =0;
        }else if(l==0 || r ==0){//contain 2019 multiple at edge
            mod = 0;
        }else if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        }



        System.out.println(mod);

    } main {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int R = sc.nextInt();
        long mod=0;

        int l = L%2019;
        int r = R%2019;
        int l1 = L/2019;
        int r1 = R/2019;

        if(R-L +1 >=2019){//large enough to contain 2019 multiples
            mod =0;
        }else if(l==0 || r ==0){//contain 2019 multiple at edge
            mod = 0;
        }else if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        }



        System.out.println(mod);

    } 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 long mod=0; mod 0 int l = L%2019; l L%2019 L 2019 int r = R%2019; r R%2019 R 2019 int l1 = L/2019; l1 L/2019 L 2019 int r1 = R/2019; r1 R/2019 R 2019 if(R-L +1 >=2019){//large enough to contain 2019 multiples
            mod =0;
        }else if(l==0 || r ==0){//contain 2019 multiple at edge
            mod = 0;
        }else if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        } R-L +1 >=2019 R-L +1 R-L R L 1 2019 {//large enough to contain 2019 multiples
            mod =0;
        } mod =0 mod 0 if(l==0 || r ==0){//contain 2019 multiple at edge
            mod = 0;
        }else if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        } l==0 || r ==0 l==0 l 0 r ==0 r 0 {//contain 2019 multiple at edge
            mod = 0;
        } mod = 0 mod 0 if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        } r1!=l1 r1 l1 {// contains 2019 in between
            mod =0;
        } mod =0 mod 0 {
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        } int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            } int i= l; int i= l; i l i < r i r ++i ++i i {
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            } {
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            } for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                } int j = l+1; int j = l+1; j l+1 l 1 j <=r j r j++ j++ j {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                } {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                } int multi = i*j; multi i*j i j int mod2 = multi%2019; mod2 multi%2019 multi 2019 min = Math.min(min, mod2) min Math.min(min, mod2) Math.min Math min mod2 if(min!=Integer.MAX_VALUE){
                mod = min;
            } min!=Integer.MAX_VALUE min Integer.MAX_VALUE Integer Integer.MAX_VALUE {
                mod = min;
            } mod = min mod min System.out.println(mod) System.out.println System.out System System.out mod 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();
        long mod=0;

        int l = L%2019;
        int r = R%2019;
        int l1 = L/2019;
        int r1 = R/2019;

        if(R-L +1 >=2019){//large enough to contain 2019 multiples
            mod =0;
        }else if(l==0 || r ==0){//contain 2019 multiple at edge
            mod = 0;
        }else if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        }



        System.out.println(mod);

    }

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

        int l = L%2019;
        int r = R%2019;
        int l1 = L/2019;
        int r1 = R/2019;

        if(R-L +1 >=2019){//large enough to contain 2019 multiples
            mod =0;
        }else if(l==0 || r ==0){//contain 2019 multiple at edge
            mod = 0;
        }else if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        }



        System.out.println(mod);

    }

} 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();
        long mod=0;

        int l = L%2019;
        int r = R%2019;
        int l1 = L/2019;
        int r1 = R/2019;

        if(R-L +1 >=2019){//large enough to contain 2019 multiples
            mod =0;
        }else if(l==0 || r ==0){//contain 2019 multiple at edge
            mod = 0;
        }else if ( r1!=l1){// contains 2019 in between
            mod =0;
        }else{
            int min = Integer.MAX_VALUE;
            for(int i= l; i < r ; ++i){
                for (int j = l+1; j <=r ; j++) {
                    int multi = i*j;
                    int mod2 = multi%2019;
                    min = Math.min(min, mod2);
                }
            }
            if(min!=Integer.MAX_VALUE){
                mod = min;
            }
        }



        System.out.println(mod);

    }

}
