import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int l = Integer.parseInt(sc.next());
		int r = Integer.parseInt(sc.next());
		sc.close();
		r -= l;
		l %= 2019;
		r += l;
		int yono = 2019;
		if(r - l > 2019){
			yono = 0;
		}else{
			for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			}
		}
		ou.print(yono + "\n");
		ou.flush();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int l = Integer.parseInt(sc.next());
		int r = Integer.parseInt(sc.next());
		sc.close();
		r -= l;
		l %= 2019;
		r += l;
		int yono = 2019;
		if(r - l > 2019){
			yono = 0;
		}else{
			for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			}
		}
		ou.print(yono + "\n");
		ou.flush();
    }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int l = Integer.parseInt(sc.next());
		int r = Integer.parseInt(sc.next());
		sc.close();
		r -= l;
		l %= 2019;
		r += l;
		int yono = 2019;
		if(r - l > 2019){
			yono = 0;
		}else{
			for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			}
		}
		ou.print(yono + "\n");
		ou.flush();
    } main {
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int l = Integer.parseInt(sc.next());
		int r = Integer.parseInt(sc.next());
		sc.close();
		r -= l;
		l %= 2019;
		r += l;
		int yono = 2019;
		if(r - l > 2019){
			yono = 0;
		}else{
			for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			}
		}
		ou.print(yono + "\n");
		ou.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter ou = new PrintWriter(System.out); ou new PrintWriter(System.out) int l = Integer.parseInt(sc.next()); l Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int r = Integer.parseInt(sc.next()); r Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc r -= l r l l %= 2019 l 2019 r += l r l int yono = 2019; yono 2019 if(r - l > 2019){
			yono = 0;
		}else{
			for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			}
		} r - l > 2019 r - l r l 2019 {
			yono = 0;
		} yono = 0 yono 0 {
			for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			}
		} for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			} int i = l ; int i = l ; i l i <= r i r i++ i++ i {
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			} {
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			} for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				} int j = l ; int j = l ; j l j < i j i j++ j++ j {
					yono = Math.min(yono , (i * j) % 2019);
				} {
					yono = Math.min(yono , (i * j) % 2019);
				} yono = Math.min(yono , (i * j) % 2019) yono Math.min(yono , (i * j) % 2019) Math.min Math yono (i * j) % 2019 (i * j) i j 2019 ou.print(yono + "\n") ou.print ou yono + "\n" yono "\n" ou.flush() ou.flush ou String[] args args public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int l = Integer.parseInt(sc.next());
		int r = Integer.parseInt(sc.next());
		sc.close();
		r -= l;
		l %= 2019;
		r += l;
		int yono = 2019;
		if(r - l > 2019){
			yono = 0;
		}else{
			for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			}
		}
		ou.print(yono + "\n");
		ou.flush();
    }
} public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int l = Integer.parseInt(sc.next());
		int r = Integer.parseInt(sc.next());
		sc.close();
		r -= l;
		l %= 2019;
		r += l;
		int yono = 2019;
		if(r - l > 2019){
			yono = 0;
		}else{
			for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			}
		}
		ou.print(yono + "\n");
		ou.flush();
    }
} Main
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int l = Integer.parseInt(sc.next());
		int r = Integer.parseInt(sc.next());
		sc.close();
		r -= l;
		l %= 2019;
		r += l;
		int yono = 2019;
		if(r - l > 2019){
			yono = 0;
		}else{
			for(int i = l ; i <= r ; i++){
				for(int j = l ; j < i ; j++){
					yono = Math.min(yono , (i * j) % 2019);
				}
			}
		}
		ou.print(yono + "\n");
		ou.flush();
    }
}