import java.util.*;

public class Main {
  public static boolean check(int num) {
    int i;
    for(i = 1; i * i <= num; i++) {
      if(i * i == num) return true;
    }
    return false;
  }

  public static void main(String[] args) {
    int i, j, number_l, number_r, ans = 2019;
    Scanner sc = new Scanner(System.in);
    number_l = Integer.parseInt(sc.next());
    number_r = Integer.parseInt(sc.next());
    if(number_r - number_l >= 2019) {
      ans = 0;
    } else {
      for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      }
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java public class Main {
  public static boolean check(int num) {
    int i;
    for(i = 1; i * i <= num; i++) {
      if(i * i == num) return true;
    }
    return false;
  }

  public static void main(String[] args) {
    int i, j, number_l, number_r, ans = 2019;
    Scanner sc = new Scanner(System.in);
    number_l = Integer.parseInt(sc.next());
    number_r = Integer.parseInt(sc.next());
    if(number_r - number_l >= 2019) {
      ans = 0;
    } else {
      for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      }
    }
    System.out.println(ans);
  }
} Main public static boolean check(int num) {
    int i;
    for(i = 1; i * i <= num; i++) {
      if(i * i == num) return true;
    }
    return false;
  } check {
    int i;
    for(i = 1; i * i <= num; i++) {
      if(i * i == num) return true;
    }
    return false;
  } int i; i for(i = 1; i * i <= num; i++) {
      if(i * i == num) return true;
    } i = 1; i = 1 i 1 i * i <= num i * i i i num i++ i++ i {
      if(i * i == num) return true;
    } {
      if(i * i == num) return true;
    } if(i * i == num) return true; i * i == num i * i i i num return true; true return false; false int num num public static void main(String[] args) {
    int i, j, number_l, number_r, ans = 2019;
    Scanner sc = new Scanner(System.in);
    number_l = Integer.parseInt(sc.next());
    number_r = Integer.parseInt(sc.next());
    if(number_r - number_l >= 2019) {
      ans = 0;
    } else {
      for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      }
    }
    System.out.println(ans);
  } main {
    int i, j, number_l, number_r, ans = 2019;
    Scanner sc = new Scanner(System.in);
    number_l = Integer.parseInt(sc.next());
    number_r = Integer.parseInt(sc.next());
    if(number_r - number_l >= 2019) {
      ans = 0;
    } else {
      for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      }
    }
    System.out.println(ans);
  } int i i j j number_l number_l number_r number_r ans = 2019; ans 2019 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) number_l = Integer.parseInt(sc.next()) number_l Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc number_r = Integer.parseInt(sc.next()) number_r Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if(number_r - number_l >= 2019) {
      ans = 0;
    } else {
      for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      }
    } number_r - number_l >= 2019 number_r - number_l number_r number_l 2019 {
      ans = 0;
    } ans = 0 ans 0 {
      for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      }
    } for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      } i = number_l; i = number_l i number_l i <= number_r i number_r i++ i++ i {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      } {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      } if(i % 2019 == 0) {
          ans = 0;
          break;
        } i % 2019 == 0 i % 2019 i 2019 0 {
          ans = 0;
          break;
        } ans = 0 ans 0 break; for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        } j = i + 1; j = i + 1 j i + 1 i 1 j <= number_r j number_r j++ j++ j {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        } {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        } if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019; ans > ((i % 2019) * (j % 2019)) % 2019 ans ((i % 2019) * (j % 2019)) % 2019 ((i % 2019) * (j % 2019)) (i % 2019) i 2019 (j % 2019) j 2019 2019 ans = (i % 2019) * (j % 2019) % 2019 ans (i % 2019) * (j % 2019) % 2019 (i % 2019) * (j % 2019) (i % 2019) i 2019 (j % 2019) j 2019 2019 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
  public static boolean check(int num) {
    int i;
    for(i = 1; i * i <= num; i++) {
      if(i * i == num) return true;
    }
    return false;
  }

  public static void main(String[] args) {
    int i, j, number_l, number_r, ans = 2019;
    Scanner sc = new Scanner(System.in);
    number_l = Integer.parseInt(sc.next());
    number_r = Integer.parseInt(sc.next());
    if(number_r - number_l >= 2019) {
      ans = 0;
    } else {
      for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      }
    }
    System.out.println(ans);
  }
} public class Main {
  public static boolean check(int num) {
    int i;
    for(i = 1; i * i <= num; i++) {
      if(i * i == num) return true;
    }
    return false;
  }

  public static void main(String[] args) {
    int i, j, number_l, number_r, ans = 2019;
    Scanner sc = new Scanner(System.in);
    number_l = Integer.parseInt(sc.next());
    number_r = Integer.parseInt(sc.next());
    if(number_r - number_l >= 2019) {
      ans = 0;
    } else {
      for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      }
    }
    System.out.println(ans);
  }
} Main
import java.util.*;

public class Main {
  public static boolean check(int num) {
    int i;
    for(i = 1; i * i <= num; i++) {
      if(i * i == num) return true;
    }
    return false;
  }

  public static void main(String[] args) {
    int i, j, number_l, number_r, ans = 2019;
    Scanner sc = new Scanner(System.in);
    number_l = Integer.parseInt(sc.next());
    number_r = Integer.parseInt(sc.next());
    if(number_r - number_l >= 2019) {
      ans = 0;
    } else {
      for(i = number_l; i <= number_r; i++) {
        if(i % 2019 == 0) {
          ans = 0;
          break;
        }
        for(j = i + 1; j <= number_r; j++) {
          if(ans > ((i % 2019) * (j % 2019)) % 2019) ans = (i % 2019) * (j % 2019) % 2019;
        }
      }
    }
    System.out.println(ans);
  }
}
