import 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 pL = l % 2019;
        int pR = r % 2019;
        
        int min = Integer.MAX_VALUE;
        if(r - l >= 2019 || l <= 2019 && 2019 <= r)
        	min = 0;
        else {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	}
        }
        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);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int pL = l % 2019;
        int pR = r % 2019;
        
        int min = Integer.MAX_VALUE;
        if(r - l >= 2019 || l <= 2019 && 2019 <= r)
        	min = 0;
        else {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 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 pL = l % 2019;
        int pR = r % 2019;
        
        int min = Integer.MAX_VALUE;
        if(r - l >= 2019 || l <= 2019 && 2019 <= r)
        	min = 0;
        else {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	}
        }
        System.out.println(min);
    } main {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int pL = l % 2019;
        int pR = r % 2019;
        
        int min = Integer.MAX_VALUE;
        if(r - l >= 2019 || l <= 2019 && 2019 <= r)
        	min = 0;
        else {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 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 pL = l % 2019; pL l % 2019 l 2019 int pR = r % 2019; pR r % 2019 r 2019 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE if(r - l >= 2019 || l <= 2019 && 2019 <= r)
        	min = 0;
        else {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	}
        } r - l >= 2019 || l <= 2019 && 2019 <= r r - l >= 2019 r - l r l 2019 l <= 2019 && 2019 <= r l <= 2019 l 2019 2019 <= r 2019 r min = 0 min 0 {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	}
        } for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	} int i = pL; int i = pL; i pL i <= pR i pR i++ i++ i {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	} {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	} for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		} int j = pL; int j = pL; j pL j <= pR j pR j++ j++ j {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		} {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		} if(j == i) continue; j == i j i continue; 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 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 pL = l % 2019;
        int pR = r % 2019;
        
        int min = Integer.MAX_VALUE;
        if(r - l >= 2019 || l <= 2019 && 2019 <= r)
        	min = 0;
        else {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 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 pL = l % 2019;
        int pR = r % 2019;
        
        int min = Integer.MAX_VALUE;
        if(r - l >= 2019 || l <= 2019 && 2019 <= r)
        	min = 0;
        else {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	}
        }
        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);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int pL = l % 2019;
        int pR = r % 2019;
        
        int min = Integer.MAX_VALUE;
        if(r - l >= 2019 || l <= 2019 && 2019 <= r)
        	min = 0;
        else {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	}
        }
        System.out.println(min);
    }
}
