import 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();
      
      if(r > l+4038)
        r = l+4038;
      
      long min = 2018;
      long num;
      int cnt = 0;
      for(long i = l; i < r; i++) {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      }
      System.out.println(min);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  long l = sc.nextLong();
	  long r = sc.nextLong();
      
      if(r > l+4038)
        r = l+4038;
      
      long min = 2018;
      long num;
      int cnt = 0;
      for(long i = l; i < r; i++) {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      }
      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();
      
      if(r > l+4038)
        r = l+4038;
      
      long min = 2018;
      long num;
      int cnt = 0;
      for(long i = l; i < r; i++) {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      }
      System.out.println(min);
	} main {
	  Scanner sc = new Scanner(System.in);
	  long l = sc.nextLong();
	  long r = sc.nextLong();
      
      if(r > l+4038)
        r = l+4038;
      
      long min = 2018;
      long num;
      int cnt = 0;
      for(long i = l; i < r; i++) {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      }
      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 if(r > l+4038)
        r = l+4038; r > l+4038 r l+4038 l 4038 r = l+4038 r l+4038 l 4038 long min = 2018; min 2018 long num; num int cnt = 0; cnt 0 for(long i = l; i < r; i++) {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      } long i = l; long i = l; i l i < r i r i++ i++ i {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      } {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      } for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        } long j = l+1; long j = l+1; j l+1 l 1 j <= r j r j++ j++ j {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        } {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        } num = ((i*j)%2019) num ((i*j)%2019) (i*j) i j 2019 if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          } num < min num min {
            min = num;
            if(num == 0) {
              break;
            }
          } min = num min num if(num == 0) {
              break;
            } num == 0 num 0 {
              break;
            } break; 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();
      
      if(r > l+4038)
        r = l+4038;
      
      long min = 2018;
      long num;
      int cnt = 0;
      for(long i = l; i < r; i++) {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      }
      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();
      
      if(r > l+4038)
        r = l+4038;
      
      long min = 2018;
      long num;
      int cnt = 0;
      for(long i = l; i < r; i++) {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      }
      System.out.println(min);
	}
} Main
import 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();
      
      if(r > l+4038)
        r = l+4038;
      
      long min = 2018;
      long num;
      int cnt = 0;
      for(long i = l; i < r; i++) {
        for(long j = l+1; j <= r; j++) {
          num = ((i*j)%2019);
          if(num < min) {
            min = num;
            if(num == 0) {
              break;
            }
          }
        }
      }
      System.out.println(min);
	}
}