import java.util.*;

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

        int mod = 2018;
        
        for(int i=L; i<Math.min(L+2018, R); i++){
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        }
        System.out.println(mod);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int L = scanner.nextInt();
        int R = scanner.nextInt();

        int mod = 2018;
        
        for(int i=L; i<Math.min(L+2018, R); i++){
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        }
        System.out.println(mod);
    }
} Main public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int L = scanner.nextInt();
        int R = scanner.nextInt();

        int mod = 2018;
        
        for(int i=L; i<Math.min(L+2018, R); i++){
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        }
        System.out.println(mod);
    } main {
        Scanner scanner = new Scanner(System.in);
        int L = scanner.nextInt();
        int R = scanner.nextInt();

        int mod = 2018;
        
        for(int i=L; i<Math.min(L+2018, R); i++){
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        }
        System.out.println(mod);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int L = scanner.nextInt(); L scanner.nextInt() scanner.nextInt scanner int R = scanner.nextInt(); R scanner.nextInt() scanner.nextInt scanner int mod = 2018; mod 2018 for(int i=L; i<Math.min(L+2018, R); i++){
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        } int i=L; int i=L; i L i<Math.min(L+2018, R) i Math.min(L+2018, R) Math.min Math L+2018 L 2018 R i++ i++ i {
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        } {
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        } for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            } int j=i+1; int j=i+1; j i+1 i 1 j<=Math.min(L+2018, R) j Math.min(L+2018, R) Math.min Math L+2018 L 2018 R j++ j++ j {
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            } {
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            } int modl = i % 2019; modl i % 2019 i 2019 int modr = j % 2019; modr j % 2019 j 2019 int modlr = (modl * modr) % 2019; modlr (modl * modr) % 2019 (modl * modr) modl modr 2019 if(modlr < mod){
                    mod = modlr;
                } modlr < mod modlr mod {
                    mod = modlr;
                } mod = modlr mod modlr 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 scanner = new Scanner(System.in);
        int L = scanner.nextInt();
        int R = scanner.nextInt();

        int mod = 2018;
        
        for(int i=L; i<Math.min(L+2018, R); i++){
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        }
        System.out.println(mod);
    }
} public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int L = scanner.nextInt();
        int R = scanner.nextInt();

        int mod = 2018;
        
        for(int i=L; i<Math.min(L+2018, R); i++){
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        }
        System.out.println(mod);
    }
} Main
import java.util.*;

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

        int mod = 2018;
        
        for(int i=L; i<Math.min(L+2018, R); i++){
            for(int j=i+1; j<=Math.min(L+2018, R); j++){
                int modl = i % 2019;
                int modr = j % 2019;
                int modlr = (modl * modr) % 2019;
                if(modlr < mod){
                    mod = modlr;
                }
            }
        }
        System.out.println(mod);
    }
}