import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    long L=gl();
	    long R=gl();
	    
        if (R-L > 2019) {
	        System.out.println(0);
	        return;
        }
        
        long min=2018;
        for (long i=L; i<=R; i++) {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        }
        
        System.out.println(min);

	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    long L=gl();
	    long R=gl();
	    
        if (R-L > 2019) {
	        System.out.println(0);
	        return;
        }
        
        long min=2018;
        for (long i=L; i<=R; i++) {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        }
        
        System.out.println(min);

	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
} Main static Scanner scanner; scanner public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    long L=gl();
	    long R=gl();
	    
        if (R-L > 2019) {
	        System.out.println(0);
	        return;
        }
        
        long min=2018;
        for (long i=L; i<=R; i++) {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        }
        
        System.out.println(min);

	} main {
	    scanner = new Scanner(System.in);

	    long L=gl();
	    long R=gl();
	    
        if (R-L > 2019) {
	        System.out.println(0);
	        return;
        }
        
        long min=2018;
        for (long i=L; i<=R; i++) {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        }
        
        System.out.println(min);

	} scanner = new Scanner(System.in) scanner new Scanner(System.in) long L=gl(); L gl() gl long R=gl(); R gl() gl if (R-L > 2019) {
	        System.out.println(0);
	        return;
        } R-L > 2019 R-L R L 2019 {
	        System.out.println(0);
	        return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; long min=2018; min 2018 for (long i=L; i<=R; i++) {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        } long i=L; long i=L; i L i<=R i R i++ i++ i {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        } {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        } for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	} long j=i+1; long j=i+1; j i+1 i 1 j<=R j R j++ j++ j {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	} {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	} long a=(i*j)%2019; a (i*j)%2019 (i*j) i j 2019 if (a<min) {
        			min=a;
        		} a<min a min {
        			min=a;
        		} min=a min a System.out.println(min) System.out.println System.out System System.out min String[] args args // 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	} gs {
		return scanner.next();
	} return scanner.next(); scanner.next() scanner.next scanner // intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	} gi {
		return Integer.parseInt(scanner.next());
	} return Integer.parseInt(scanner.next()); Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner // longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	} gl {
		return Long.parseLong(scanner.next());
	} return Long.parseLong(scanner.next()); Long.parseLong(scanner.next()) Long.parseLong Long scanner.next() scanner.next scanner public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    long L=gl();
	    long R=gl();
	    
        if (R-L > 2019) {
	        System.out.println(0);
	        return;
        }
        
        long min=2018;
        for (long i=L; i<=R; i++) {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        }
        
        System.out.println(min);

	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
} public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    long L=gl();
	    long R=gl();
	    
        if (R-L > 2019) {
	        System.out.println(0);
	        return;
        }
        
        long min=2018;
        for (long i=L; i<=R; i++) {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        }
        
        System.out.println(min);

	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    long L=gl();
	    long R=gl();
	    
        if (R-L > 2019) {
	        System.out.println(0);
	        return;
        }
        
        long min=2018;
        for (long i=L; i<=R; i++) {
        	for (long j=i+1; j<=R; j++) {
        		long a=(i*j)%2019;
        		if (a<min) {
        			min=a;
        		}
        	}
        }
        
        System.out.println(min);

	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
}