import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		sc.close();
		if(r - l >= 2018) {
			System.out.println(0);
			return;
		}
		long lMod = (l + 2019) % 2019;
		long rMod = (r + 2019) % 2019;
      if(rMod < lMod)
        rMod += 2019;
		long min = 100000;
		for(long i = lMod ; i <= rMod - 1 ; i++) {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		}
      System.out.println(min);

	}
}
 import java.util.Scanner; Scanner 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();
		sc.close();
		if(r - l >= 2018) {
			System.out.println(0);
			return;
		}
		long lMod = (l + 2019) % 2019;
		long rMod = (r + 2019) % 2019;
      if(rMod < lMod)
        rMod += 2019;
		long min = 100000;
		for(long i = lMod ; i <= rMod - 1 ; i++) {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		}
      System.out.println(min);

	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		sc.close();
		if(r - l >= 2018) {
			System.out.println(0);
			return;
		}
		long lMod = (l + 2019) % 2019;
		long rMod = (r + 2019) % 2019;
      if(rMod < lMod)
        rMod += 2019;
		long min = 100000;
		for(long i = lMod ; i <= rMod - 1 ; i++) {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		}
      System.out.println(min);

	} main {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		sc.close();
		if(r - l >= 2018) {
			System.out.println(0);
			return;
		}
		long lMod = (l + 2019) % 2019;
		long rMod = (r + 2019) % 2019;
      if(rMod < lMod)
        rMod += 2019;
		long min = 100000;
		for(long i = lMod ; i <= rMod - 1 ; i++) {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		}
      System.out.println(min);

	} 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 sc.close() sc.close sc if(r - l >= 2018) {
			System.out.println(0);
			return;
		} r - l >= 2018 r - l r l 2018 {
			System.out.println(0);
			return;
		} System.out.println(0) System.out.println System.out System System.out 0 return; long lMod = (l + 2019) % 2019; lMod (l + 2019) % 2019 (l + 2019) l 2019 2019 long rMod = (r + 2019) % 2019; rMod (r + 2019) % 2019 (r + 2019) r 2019 2019 if(rMod < lMod)
        rMod += 2019; rMod < lMod rMod lMod rMod += 2019 rMod 2019 long min = 100000; min 100000 for(long i = lMod ; i <= rMod - 1 ; i++) {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		} long i = lMod ; long i = lMod ; i lMod i <= rMod - 1 i rMod - 1 rMod 1 i++ i++ i {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		} {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		} for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			} long j = i + 1 ; long j = i + 1 ; j i + 1 i 1 j <= rMod j rMod j++ j++ j {
				min = Math.min((i * j) % 2019 , min);
			} {
				min = Math.min((i * j) % 2019 , min);
			} min = Math.min((i * j) % 2019 , min) min Math.min((i * j) % 2019 , min) Math.min Math (i * j) % 2019 (i * j) i j 2019 min 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) {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		sc.close();
		if(r - l >= 2018) {
			System.out.println(0);
			return;
		}
		long lMod = (l + 2019) % 2019;
		long rMod = (r + 2019) % 2019;
      if(rMod < lMod)
        rMod += 2019;
		long min = 100000;
		for(long i = lMod ; i <= rMod - 1 ; i++) {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		}
      System.out.println(min);

	}
} public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		sc.close();
		if(r - l >= 2018) {
			System.out.println(0);
			return;
		}
		long lMod = (l + 2019) % 2019;
		long rMod = (r + 2019) % 2019;
      if(rMod < lMod)
        rMod += 2019;
		long min = 100000;
		for(long i = lMod ; i <= rMod - 1 ; i++) {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		}
      System.out.println(min);

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		sc.close();
		if(r - l >= 2018) {
			System.out.println(0);
			return;
		}
		long lMod = (l + 2019) % 2019;
		long rMod = (r + 2019) % 2019;
      if(rMod < lMod)
        rMod += 2019;
		long min = 100000;
		for(long i = lMod ; i <= rMod - 1 ; i++) {
			for(long j = i + 1 ; j <= rMod ; j++) {
				min = Math.min((i * j) % 2019 , min);
			}
		}
      System.out.println(min);

	}
}

