
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int l=scn.nextInt();
		int r=scn.nextInt();
		if((2019<l||r<2019)&&r-l<2019) {
			l=l%2019;
			r=r%2019;
			if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			}
		}
		else {
			System.out.println(0);
		}
	}
	
	public static void func(int l, int r) {
		
		int min=Integer.MAX_VALUE;
		for(int i=l;i<r;i++) {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		}
		System.out.println(min);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int l=scn.nextInt();
		int r=scn.nextInt();
		if((2019<l||r<2019)&&r-l<2019) {
			l=l%2019;
			r=r%2019;
			if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			}
		}
		else {
			System.out.println(0);
		}
	}
	
	public static void func(int l, int r) {
		
		int min=Integer.MAX_VALUE;
		for(int i=l;i<r;i++) {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		}
		System.out.println(min);

	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int l=scn.nextInt();
		int r=scn.nextInt();
		if((2019<l||r<2019)&&r-l<2019) {
			l=l%2019;
			r=r%2019;
			if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			}
		}
		else {
			System.out.println(0);
		}
	} main {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int l=scn.nextInt();
		int r=scn.nextInt();
		if((2019<l||r<2019)&&r-l<2019) {
			l=l%2019;
			r=r%2019;
			if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			}
		}
		else {
			System.out.println(0);
		}
	} Scanner scn=new Scanner(System.in); scn new Scanner(System.in) int l=scn.nextInt(); l scn.nextInt() scn.nextInt scn int r=scn.nextInt(); r scn.nextInt() scn.nextInt scn if((2019<l||r<2019)&&r-l<2019) {
			l=l%2019;
			r=r%2019;
			if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			}
		}
		else {
			System.out.println(0);
		} (2019<l||r<2019)&&r-l<2019 (2019<l||r<2019) 2019<l 2019 l r<2019 r 2019 r-l<2019 r-l r l 2019 {
			l=l%2019;
			r=r%2019;
			if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			}
		} l=l%2019 l l%2019 l 2019 r=r%2019 r r%2019 r 2019 if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			} l<r l r func(l,r) func l r {
				System.out.println(0);
			} System.out.println(0) System.out.println System.out System System.out 0 {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 String[] args args public static void func(int l, int r) {
		
		int min=Integer.MAX_VALUE;
		for(int i=l;i<r;i++) {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		}
		System.out.println(min);

	} func {
		
		int min=Integer.MAX_VALUE;
		for(int i=l;i<r;i++) {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		}
		System.out.println(min);

	} int min=Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=l;i<r;i++) {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		} int i=l; int i=l; i l i<r i r i++ i++ i {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		} {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		} for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			} int j=i+1; int j=i+1; j i+1 i 1 j<=r j r j++ j++ j {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			} {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			} int x=(i*j)%2019; x (i*j)%2019 (i*j) i j 2019 if(x<min) {
					min=x;
				} x<min x min {
					min=x;
				} min=x min x System.out.println(min) System.out.println System.out System System.out min int l l int r r public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int l=scn.nextInt();
		int r=scn.nextInt();
		if((2019<l||r<2019)&&r-l<2019) {
			l=l%2019;
			r=r%2019;
			if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			}
		}
		else {
			System.out.println(0);
		}
	}
	
	public static void func(int l, int r) {
		
		int min=Integer.MAX_VALUE;
		for(int i=l;i<r;i++) {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		}
		System.out.println(min);

	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int l=scn.nextInt();
		int r=scn.nextInt();
		if((2019<l||r<2019)&&r-l<2019) {
			l=l%2019;
			r=r%2019;
			if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			}
		}
		else {
			System.out.println(0);
		}
	}
	
	public static void func(int l, int r) {
		
		int min=Integer.MAX_VALUE;
		for(int i=l;i<r;i++) {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		}
		System.out.println(min);

	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int l=scn.nextInt();
		int r=scn.nextInt();
		if((2019<l||r<2019)&&r-l<2019) {
			l=l%2019;
			r=r%2019;
			if(l<r)
			func(l,r);
			else {
				System.out.println(0);
			}
		}
		else {
			System.out.println(0);
		}
	}
	
	public static void func(int l, int r) {
		
		int min=Integer.MAX_VALUE;
		for(int i=l;i<r;i++) {
			for(int j=i+1;j<=r;j++) {
				int x=(i*j)%2019;
				if(x<min) {
					min=x;
				}
			}
		}
		System.out.println(min);

	}

}
