import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        
        long L = sc.nextLong();
        long R = sc.nextLong();
        
        long tmp = L / 2019;
        if(tmp > 0){
            L = L - (2019 * tmp);
            R = R - (2019 * tmp);
        }

        long min = Integer.MAX_VALUE;
        if(R - L < 2019){
            for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            }
        }else{
            min = 0;
        }
        System.out.println(min);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        long L = sc.nextLong();
        long R = sc.nextLong();
        
        long tmp = L / 2019;
        if(tmp > 0){
            L = L - (2019 * tmp);
            R = R - (2019 * tmp);
        }

        long min = Integer.MAX_VALUE;
        if(R - L < 2019){
            for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            }
        }else{
            min = 0;
        }
        System.out.println(min);
    }
} Main public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        long L = sc.nextLong();
        long R = sc.nextLong();
        
        long tmp = L / 2019;
        if(tmp > 0){
            L = L - (2019 * tmp);
            R = R - (2019 * tmp);
        }

        long min = Integer.MAX_VALUE;
        if(R - L < 2019){
            for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            }
        }else{
            min = 0;
        }
        System.out.println(min);
    } main {

        Scanner sc = new Scanner(System.in);
        
        long L = sc.nextLong();
        long R = sc.nextLong();
        
        long tmp = L / 2019;
        if(tmp > 0){
            L = L - (2019 * tmp);
            R = R - (2019 * tmp);
        }

        long min = Integer.MAX_VALUE;
        if(R - L < 2019){
            for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            }
        }else{
            min = 0;
        }
        System.out.println(min);
    } 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 tmp = L / 2019; tmp L / 2019 L 2019 if(tmp > 0){
            L = L - (2019 * tmp);
            R = R - (2019 * tmp);
        } tmp > 0 tmp 0 {
            L = L - (2019 * tmp);
            R = R - (2019 * tmp);
        } L = L - (2019 * tmp) L L - (2019 * tmp) L (2019 * tmp) 2019 tmp R = R - (2019 * tmp) R R - (2019 * tmp) R (2019 * tmp) 2019 tmp long min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE if(R - L < 2019){
            for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            }
        }else{
            min = 0;
        } R - L < 2019 R - L R L 2019 {
            for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            }
        } for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            } long i = L; long i = L; i L i < R i R i++ i++ i {
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            } {
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            } for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                } long j = i+1; long j = i+1; j i+1 i 1 j <= R j R j++ j++ j {
                    min = Math.min(min,(i * j) % 2019);
                } {
                    min = Math.min(min,(i * j) % 2019);
                } min = Math.min(min,(i * j) % 2019) min Math.min(min,(i * j) % 2019) Math.min Math min (i * j) % 2019 (i * j) i j 2019 {
            min = 0;
        } min = 0 min 0 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);
        
        long L = sc.nextLong();
        long R = sc.nextLong();
        
        long tmp = L / 2019;
        if(tmp > 0){
            L = L - (2019 * tmp);
            R = R - (2019 * tmp);
        }

        long min = Integer.MAX_VALUE;
        if(R - L < 2019){
            for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            }
        }else{
            min = 0;
        }
        System.out.println(min);
    }
} public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        long L = sc.nextLong();
        long R = sc.nextLong();
        
        long tmp = L / 2019;
        if(tmp > 0){
            L = L - (2019 * tmp);
            R = R - (2019 * tmp);
        }

        long min = Integer.MAX_VALUE;
        if(R - L < 2019){
            for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            }
        }else{
            min = 0;
        }
        System.out.println(min);
    }
} Main
import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        
        long L = sc.nextLong();
        long R = sc.nextLong();
        
        long tmp = L / 2019;
        if(tmp > 0){
            L = L - (2019 * tmp);
            R = R - (2019 * tmp);
        }

        long min = Integer.MAX_VALUE;
        if(R - L < 2019){
            for(long i = L; i < R; i++){
                for(long j = i+1; j <= R; j++){
                    min = Math.min(min,(i * j) % 2019);
                }
            }
        }else{
            min = 0;
        }
        System.out.println(min);
    }
}
