

import java.util.Scanner;

public class Main {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		long l=scan.nextLong();
		long r=scan.nextLong();
		long ans=Long.MAX_VALUE;
		for(long i=l;i<=(Math.min(r, l+2018));i++)
		{
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		}
		System.out.println(ans);
		
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		long l=scan.nextLong();
		long r=scan.nextLong();
		long ans=Long.MAX_VALUE;
		for(long i=l;i<=(Math.min(r, l+2018));i++)
		{
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		}
		System.out.println(ans);
		
	}
} Main public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		long l=scan.nextLong();
		long r=scan.nextLong();
		long ans=Long.MAX_VALUE;
		for(long i=l;i<=(Math.min(r, l+2018));i++)
		{
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		}
		System.out.println(ans);
		
	} main {
		Scanner scan=new Scanner(System.in);
		long l=scan.nextLong();
		long r=scan.nextLong();
		long ans=Long.MAX_VALUE;
		for(long i=l;i<=(Math.min(r, l+2018));i++)
		{
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		}
		System.out.println(ans);
		
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) long l=scan.nextLong(); l scan.nextLong() scan.nextLong scan long r=scan.nextLong(); r scan.nextLong() scan.nextLong scan long ans=Long.MAX_VALUE; ans Long.MAX_VALUE Long Long.MAX_VALUE for(long i=l;i<=(Math.min(r, l+2018));i++)
		{
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		} long i=l; long i=l; i l i<=(Math.min(r, l+2018)) i (Math.min(r, l+2018)) Math.min Math r l+2018 l 2018 i++ i++ i {
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		} {
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		} for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			} long j=i+1; long j=i+1; j i+1 i 1 j<=Math.min(r,l+2018) j Math.min(r,l+2018) Math.min Math r l+2018 l 2018 j++ j++ j {
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			} {
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			} ans=Math.min(ans,((i%2019)*(j%2019))%2019) ans Math.min(ans,((i%2019)*(j%2019))%2019) Math.min Math ans ((i%2019)*(j%2019))%2019 ((i%2019)*(j%2019)) (i%2019) i 2019 (j%2019) j 2019 2019 System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		long l=scan.nextLong();
		long r=scan.nextLong();
		long ans=Long.MAX_VALUE;
		for(long i=l;i<=(Math.min(r, l+2018));i++)
		{
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		}
		System.out.println(ans);
		
	}
} public class Main {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		long l=scan.nextLong();
		long r=scan.nextLong();
		long ans=Long.MAX_VALUE;
		for(long i=l;i<=(Math.min(r, l+2018));i++)
		{
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		}
		System.out.println(ans);
		
	}
} Main


import java.util.Scanner;

public class Main {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		long l=scan.nextLong();
		long r=scan.nextLong();
		long ans=Long.MAX_VALUE;
		for(long i=l;i<=(Math.min(r, l+2018));i++)
		{
			for(long j=i+1;j<=Math.min(r,l+2018);j++)
			{
				ans=Math.min(ans,((i%2019)*(j%2019))%2019);
			}
		}
		System.out.println(ans);
		
	}
}
