import java.io.*;

public class Main{
	public static final int YEAR = 2019;
	
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);
		
		if( R - L != R%YEAR - L%YEAR ){
			System.out.println(0);
		}else{
			L %= YEAR; R %= YEAR;
			int min = L*(L+1)%YEAR;
			for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR;
			System.out.println(min);
		}
	}
} import java.io.*; io.* java public class Main{
	public static final int YEAR = 2019;
	
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);
		
		if( R - L != R%YEAR - L%YEAR ){
			System.out.println(0);
		}else{
			L %= YEAR; R %= YEAR;
			int min = L*(L+1)%YEAR;
			for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR;
			System.out.println(min);
		}
	}
} Main public static final int YEAR = 2019; YEAR 2019 public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);
		
		if( R - L != R%YEAR - L%YEAR ){
			System.out.println(0);
		}else{
			L %= YEAR; R %= YEAR;
			int min = L*(L+1)%YEAR;
			for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR;
			System.out.println(min);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);
		
		if( R - L != R%YEAR - L%YEAR ){
			System.out.println(0);
		}else{
			L %= YEAR; R %= YEAR;
			int min = L*(L+1)%YEAR;
			for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR;
			System.out.println(min);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int L = Integer.parseInt(line[0]); L Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int R = Integer.parseInt(line[1]); R Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 if( R - L != R%YEAR - L%YEAR ){
			System.out.println(0);
		}else{
			L %= YEAR; R %= YEAR;
			int min = L*(L+1)%YEAR;
			for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR;
			System.out.println(min);
		} R - L != R%YEAR - L%YEAR R - L R L R%YEAR - L%YEAR R%YEAR R YEAR L%YEAR L YEAR {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			L %= YEAR; R %= YEAR;
			int min = L*(L+1)%YEAR;
			for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR;
			System.out.println(min);
		} L %= YEAR L YEAR R %= YEAR R YEAR int min = L*(L+1)%YEAR; min L*(L+1)%YEAR L*(L+1) L (L+1) L 1 YEAR for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR; int i=L; int i=L; i L i<R i R i++ i++ i for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR; for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR; int j=i+1; int j=i+1; j i+1 i 1 j<=R j R j++ j++ j if( i*j%YEAR < min )
					min = i*j%YEAR; if( i*j%YEAR < min )
					min = i*j%YEAR; i*j%YEAR < min i*j%YEAR i*j i j YEAR min min = i*j%YEAR min i*j%YEAR i*j i j YEAR System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main{
	public static final int YEAR = 2019;
	
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);
		
		if( R - L != R%YEAR - L%YEAR ){
			System.out.println(0);
		}else{
			L %= YEAR; R %= YEAR;
			int min = L*(L+1)%YEAR;
			for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR;
			System.out.println(min);
		}
	}
} public class Main{
	public static final int YEAR = 2019;
	
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);
		
		if( R - L != R%YEAR - L%YEAR ){
			System.out.println(0);
		}else{
			L %= YEAR; R %= YEAR;
			int min = L*(L+1)%YEAR;
			for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR;
			System.out.println(min);
		}
	}
} Main
import java.io.*;

public class Main{
	public static final int YEAR = 2019;
	
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		int L = Integer.parseInt(line[0]);
		int R = Integer.parseInt(line[1]);
		
		if( R - L != R%YEAR - L%YEAR ){
			System.out.println(0);
		}else{
			L %= YEAR; R %= YEAR;
			int min = L*(L+1)%YEAR;
			for(int i=L; i<R; i++) for(int j=i+1; j<=R; j++)
				if( i*j%YEAR < min )
					min = i*j%YEAR;
			System.out.println(min);
		}
	}
}
