import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		long ans = 0;
		long minium = 2019;
		if( R-L < 2019 ){
			loop:for( long i=L; i<=R-1; i++ ){
				for( long j=i+1; j<=R; j++ ){
					ans = ((i%2019L)*(j%2019L))%2019L;
					minium = Math.min(ans,minium);
					if( minium==0 ){
						break loop;
					}
				}
			}
		}else{
			minium = 0;
		}
		System.out.println(minium);
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		long ans = 0;
		long minium = 2019;
		if( R-L < 2019 ){
			loop:for( long i=L; i<=R-1; i++ ){
				for( long j=i+1; j<=R; j++ ){
					ans = ((i%2019L)*(j%2019L))%2019L;
					minium = Math.min(ans,minium);
					if( minium==0 ){
						break loop;
					}
				}
			}
		}else{
			minium = 0;
		}
		System.out.println(minium);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		long ans = 0;
		long minium = 2019;
		if( R-L < 2019 ){
			loop:for( long i=L; i<=R-1; i++ ){
				for( long j=i+1; j<=R; j++ ){
					ans = ((i%2019L)*(j%2019L))%2019L;
					minium = Math.min(ans,minium);
					if( minium==0 ){
						break loop;
					}
				}
			}
		}else{
			minium = 0;
		}
		System.out.println(minium);
	} main {
		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		long ans = 0;
		long minium = 2019;
		if( R-L < 2019 ){
			loop:for( long i=L; i<=R-1; i++ ){
				for( long j=i+1; j<=R; j++ ){
					ans = ((i%2019L)*(j%2019L))%2019L;
					minium = Math.min(ans,minium);
					if( minium==0 ){
						break loop;
					}
				}
			}
		}else{
			minium = 0;
		}
		System.out.println(minium);
	} 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 ans = 0; ans 0 long minium = 2019; minium 2019 if( R-L < 2019 ){
			loop:for( long i=L; i<=R-1; i++ ){
				for( long j=i+1; j<=R; j++ ){
					ans = ((i%2019L)*(j%2019L))%2019L;
					minium = Math.min(ans,minium);
					if( minium==0 ){
						break loop;
					}
				}
			}
		}else{
			minium = 0;
		} R-L < 2019 R-L R L 2019 {
			loop:for( long i=L; i<=R-1; i++ ){
				for( long j=i+1; j<=R; j++ ){
					ans = ((i%2019L)*(j%2019L))%2019L;
					minium = Math.min(ans,minium);
					if( minium==0 ){
						break loop;
					}
				}
			}
		} {
			minium = 0;
		} minium = 0 minium 0 System.out.println(minium) System.out.println System.out System System.out minium String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		long ans = 0;
		long minium = 2019;
		if( R-L < 2019 ){
			loop:for( long i=L; i<=R-1; i++ ){
				for( long j=i+1; j<=R; j++ ){
					ans = ((i%2019L)*(j%2019L))%2019L;
					minium = Math.min(ans,minium);
					if( minium==0 ){
						break loop;
					}
				}
			}
		}else{
			minium = 0;
		}
		System.out.println(minium);
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		long ans = 0;
		long minium = 2019;
		if( R-L < 2019 ){
			loop:for( long i=L; i<=R-1; i++ ){
				for( long j=i+1; j<=R; j++ ){
					ans = ((i%2019L)*(j%2019L))%2019L;
					minium = Math.min(ans,minium);
					if( minium==0 ){
						break loop;
					}
				}
			}
		}else{
			minium = 0;
		}
		System.out.println(minium);
	}
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long L = sc.nextLong();
		long R = sc.nextLong();
		long ans = 0;
		long minium = 2019;
		if( R-L < 2019 ){
			loop:for( long i=L; i<=R-1; i++ ){
				for( long j=i+1; j<=R; j++ ){
					ans = ((i%2019L)*(j%2019L))%2019L;
					minium = Math.min(ans,minium);
					if( minium==0 ){
						break loop;
					}
				}
			}
		}else{
			minium = 0;
		}
		System.out.println(minium);
	}
}
