import java.io.*;
import java.math.BigInteger;
import java.util.*;


public class  Main{
    public static void main(String[] args) throws Exception{
    	MScanner sc = new MScanner(System.in);
        //MScanner sc = new MScanner("reduce.in");
        PrintWriter pw=new PrintWriter(System.out);
        int l=sc.nextInt();int r=sc.nextInt();
        if(r-l+1>=2019) {
        	pw.println(0);
        }
        else {
        	int ans=1000000000;
        	for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	}
        	pw.println(ans);
        }
        pw.flush();
    }
    
    
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
} import java.io.*; io.* java import java.math.BigInteger; BigInteger java.math import java.util.*; util.* java public class  Main{
    public static void main(String[] args) throws Exception{
    	MScanner sc = new MScanner(System.in);
        //MScanner sc = new MScanner("reduce.in");
        PrintWriter pw=new PrintWriter(System.out);
        int l=sc.nextInt();int r=sc.nextInt();
        if(r-l+1>=2019) {
        	pw.println(0);
        }
        else {
        	int ans=1000000000;
        	for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	}
        	pw.println(ans);
        }
        pw.flush();
    }
    
    
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
} Main public static void main(String[] args) throws Exception{
    	MScanner sc = new MScanner(System.in);
        //MScanner sc = new MScanner("reduce.in");
        PrintWriter pw=new PrintWriter(System.out);
        int l=sc.nextInt();int r=sc.nextInt();
        if(r-l+1>=2019) {
        	pw.println(0);
        }
        else {
        	int ans=1000000000;
        	for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	}
        	pw.println(ans);
        }
        pw.flush();
    } main {
    	MScanner sc = new MScanner(System.in);
        //MScanner sc = new MScanner("reduce.in");
        PrintWriter pw=new PrintWriter(System.out);
        int l=sc.nextInt();int r=sc.nextInt();
        if(r-l+1>=2019) {
        	pw.println(0);
        }
        else {
        	int ans=1000000000;
        	for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	}
        	pw.println(ans);
        }
        pw.flush();
    } MScanner sc = new MScanner(System.in); sc new MScanner(System.in) PrintWriter pw=new PrintWriter(System.out); pw new PrintWriter(System.out) int l=sc.nextInt(); l sc.nextInt() sc.nextInt sc int r=sc.nextInt(); r sc.nextInt() sc.nextInt sc if(r-l+1>=2019) {
        	pw.println(0);
        }
        else {
        	int ans=1000000000;
        	for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	}
        	pw.println(ans);
        } r-l+1>=2019 r-l+1 r-l r l 1 2019 {
        	pw.println(0);
        } pw.println(0) pw.println pw 0 {
        	int ans=1000000000;
        	for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	}
        	pw.println(ans);
        } int ans=1000000000; ans 1000000000 for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	} int i=l; int i=l; i l i<=r i r i++ i++ i {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	} {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	} for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		} int j=i+1; int j=i+1; j i+1 i 1 j<=r j r j++ j++ j {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		} {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		} ans=(int)Math.min(ans,(i*1l*j*1l)%2019) ans (int)Math.min(ans,(i*1l*j*1l)%2019) Math.min Math ans (i*1l*j*1l)%2019 (i*1l*j*1l) j i*1l*j*1l i 1l j 1l 2019 pw.println(ans) pw.println pw ans pw.flush() pw.flush pw String[] args args static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	} MScanner StringTokenizer st; st BufferedReader br; br public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		} MScanner {
			br = new BufferedReader(new InputStreamReader(system));
		} br = new BufferedReader(new InputStreamReader(system)) br new BufferedReader(new InputStreamReader(system)) InputStream system system public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		} MScanner {
			br = new BufferedReader(new FileReader(file));
		} br = new BufferedReader(new FileReader(file)) br new BufferedReader(new FileReader(file)) String file file public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		} next {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		} while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public String nextLine() throws IOException {
			return br.readLine();
		} nextLine {
			return br.readLine();
		} return br.readLine(); br.readLine() br.readLine br public int nextInt() throws IOException {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		} nextDouble {
			return Double.parseDouble(next());
		} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public char nextChar() throws IOException {
			return next().charAt(0);
		} nextChar {
			return next().charAt(0);
		} return next().charAt(0); next().charAt(0) next().charAt next() next 0 public Long nextLong() throws IOException {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public boolean ready() throws IOException {
			return br.ready();
		} ready {
			return br.ready();
		} return br.ready(); br.ready() br.ready br public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		} waitForInput {
			Thread.sleep(3000);
		} Thread.sleep(3000) Thread.sleep Thread 3000 public class  Main{
    public static void main(String[] args) throws Exception{
    	MScanner sc = new MScanner(System.in);
        //MScanner sc = new MScanner("reduce.in");
        PrintWriter pw=new PrintWriter(System.out);
        int l=sc.nextInt();int r=sc.nextInt();
        if(r-l+1>=2019) {
        	pw.println(0);
        }
        else {
        	int ans=1000000000;
        	for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	}
        	pw.println(ans);
        }
        pw.flush();
    }
    
    
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
} public class  Main{
    public static void main(String[] args) throws Exception{
    	MScanner sc = new MScanner(System.in);
        //MScanner sc = new MScanner("reduce.in");
        PrintWriter pw=new PrintWriter(System.out);
        int l=sc.nextInt();int r=sc.nextInt();
        if(r-l+1>=2019) {
        	pw.println(0);
        }
        else {
        	int ans=1000000000;
        	for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	}
        	pw.println(ans);
        }
        pw.flush();
    }
    
    
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
} Main
import java.io.*;
import java.math.BigInteger;
import java.util.*;


public class  Main{
    public static void main(String[] args) throws Exception{
    	MScanner sc = new MScanner(System.in);
        //MScanner sc = new MScanner("reduce.in");
        PrintWriter pw=new PrintWriter(System.out);
        int l=sc.nextInt();int r=sc.nextInt();
        if(r-l+1>=2019) {
        	pw.println(0);
        }
        else {
        	int ans=1000000000;
        	for(int i=l;i<=r;i++) {
        		for(int j=i+1;j<=r;j++) {
        			ans=(int)Math.min(ans,(i*1l*j*1l)%2019);
        		}
        	}
        	pw.println(ans);
        }
        pw.flush();
    }
    
    
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}