import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean hasNext(){return sc.hasNext();}
        static char[] mySplit(String str){return str.toCharArray();}
        public static void main(String[] args){
          long L = getLong();
          long R = getLong();
          
          long output = 2020;
          for(long i = L; i < R; i++){
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          }
          myout(output);
        }
        //Method addition frame start

        //Method addition frame end
} import java.util.*; util.* java public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean hasNext(){return sc.hasNext();}
        static char[] mySplit(String str){return str.toCharArray();}
        public static void main(String[] args){
          long L = getLong();
          long R = getLong();
          
          long output = 2020;
          for(long i = L; i < R; i++){
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          }
          myout(output);
        }
        //Method addition frame start

        //Method addition frame end
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static void myout(Object t){System.out.println(t);}//standard output myout {System.out.println(t);} System.out.println(t) System.out.println System.out System System.out t Object t t static void myerr(Object t){System.err.println(t);}//standard error myerr {System.err.println(t);} System.err.println(t) System.err.println System.err System System.err t Object t t static String getStr(){return sc.next();} getStr {return sc.next();} return sc.next(); sc.next() sc.next sc static int getInt(){return Integer.parseInt(getStr());} getInt {return Integer.parseInt(getStr());} return Integer.parseInt(getStr()); Integer.parseInt(getStr()) Integer.parseInt Integer getStr() getStr static long getLong(){return Long.parseLong(getStr());} getLong {return Long.parseLong(getStr());} return Long.parseLong(getStr()); Long.parseLong(getStr()) Long.parseLong Long getStr() getStr static boolean hasNext(){return sc.hasNext();} hasNext {return sc.hasNext();} return sc.hasNext(); sc.hasNext() sc.hasNext sc static char[] mySplit(String str){return str.toCharArray();} mySplit {return str.toCharArray();} return str.toCharArray(); str.toCharArray() str.toCharArray str String str str public static void main(String[] args){
          long L = getLong();
          long R = getLong();
          
          long output = 2020;
          for(long i = L; i < R; i++){
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          }
          myout(output);
        } main {
          long L = getLong();
          long R = getLong();
          
          long output = 2020;
          for(long i = L; i < R; i++){
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          }
          myout(output);
        } long L = getLong(); L getLong() getLong long R = getLong(); R getLong() getLong long output = 2020; output 2020 for(long i = L; i < R; i++){
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          } long i = L; long i = L; i L i < R i R i++ i++ i {
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          } {
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          } for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            } {
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            } long tmp = (i * j) % 2019; tmp (i * j) % 2019 (i * j) i j 2019 output = Math.min(output,tmp) output Math.min(output,tmp) Math.min Math output tmp if(output == 0){
                myout(output);
                return;
              } output == 0 output 0 {
                myout(output);
                return;
              } myout(output) myout output return; myout(output) myout output String[] args args public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean hasNext(){return sc.hasNext();}
        static char[] mySplit(String str){return str.toCharArray();}
        public static void main(String[] args){
          long L = getLong();
          long R = getLong();
          
          long output = 2020;
          for(long i = L; i < R; i++){
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          }
          myout(output);
        }
        //Method addition frame start

        //Method addition frame end
} public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean hasNext(){return sc.hasNext();}
        static char[] mySplit(String str){return str.toCharArray();}
        public static void main(String[] args){
          long L = getLong();
          long R = getLong();
          
          long output = 2020;
          for(long i = L; i < R; i++){
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          }
          myout(output);
        }
        //Method addition frame start

        //Method addition frame end
} Main
import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean hasNext(){return sc.hasNext();}
        static char[] mySplit(String str){return str.toCharArray();}
        public static void main(String[] args){
          long L = getLong();
          long R = getLong();
          
          long output = 2020;
          for(long i = L; i < R; i++){
            for(long j = i + 1; j <= R; j++){
              long tmp = (i * j) % 2019;
              output = Math.min(output,tmp);
              if(output == 0){
                myout(output);
                return;
              }
            }
          }
          myout(output);
        }
        //Method addition frame start

        //Method addition frame end
}
