import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int L = sc.nextInt();
        int R = sc.nextInt();
        
        int min = 2019 * 2019;
        R = Math.min(R, L + 2050);
        
        for(int i = L; i < R; i++){
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        }
        
        System.out.println( min );
        
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int L = sc.nextInt();
        int R = sc.nextInt();
        
        int min = 2019 * 2019;
        R = Math.min(R, L + 2050);
        
        for(int i = L; i < R; i++){
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        }
        
        System.out.println( min );
        
    }
} Main public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int L = sc.nextInt();
        int R = sc.nextInt();
        
        int min = 2019 * 2019;
        R = Math.min(R, L + 2050);
        
        for(int i = L; i < R; i++){
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        }
        
        System.out.println( min );
        
    } main {

        Scanner sc = new Scanner(System.in);
        
        int L = sc.nextInt();
        int R = sc.nextInt();
        
        int min = 2019 * 2019;
        R = Math.min(R, L + 2050);
        
        for(int i = L; i < R; i++){
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        }
        
        System.out.println( min );
        
    } 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 int min = 2019 * 2019; min 2019 * 2019 2019 2019 R = Math.min(R, L + 2050) R Math.min(R, L + 2050) Math.min Math R L + 2050 L 2050 for(int i = L; i < R; i++){
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        } int i = L; int i = L; i L i < R i R i++ i++ i {
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        } {
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        } for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            } {
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            } min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 ) min Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 ) Math.min Math min ( (i % 2019) * (j % 2019) ) % 2019 ( (i % 2019) * (j % 2019) ) (i % 2019) i 2019 (j % 2019) j 2019 2019 System.out.println( min ) System.out.println System.out System System.out min String[] args args public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int L = sc.nextInt();
        int R = sc.nextInt();
        
        int min = 2019 * 2019;
        R = Math.min(R, L + 2050);
        
        for(int i = L; i < R; i++){
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        }
        
        System.out.println( min );
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int L = sc.nextInt();
        int R = sc.nextInt();
        
        int min = 2019 * 2019;
        R = Math.min(R, L + 2050);
        
        for(int i = L; i < R; i++){
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        }
        
        System.out.println( min );
        
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int L = sc.nextInt();
        int R = sc.nextInt();
        
        int min = 2019 * 2019;
        R = Math.min(R, L + 2050);
        
        for(int i = L; i < R; i++){
            for(int j = i + 1; j <= R; j++){
                min = Math.min(min, ( (i % 2019) * (j % 2019) ) % 2019 );
            }
        }
        
        System.out.println( min );
        
    }
}
