import java.util.*;
import java.util.stream.*;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner in = new Scanner(System.in);
    int L = in.nextInt(), R = in.nextInt();
    int ans = Integer.MAX_VALUE;
    for (int i = L; i < Math.min(L + 2019, R); i++) {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java import java.util.stream.*; stream.* java.util public class Main {
  public static void main(String[] args) throws Exception {
    Scanner in = new Scanner(System.in);
    int L = in.nextInt(), R = in.nextInt();
    int ans = Integer.MAX_VALUE;
    for (int i = L; i < Math.min(L + 2019, R); i++) {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) throws Exception {
    Scanner in = new Scanner(System.in);
    int L = in.nextInt(), R = in.nextInt();
    int ans = Integer.MAX_VALUE;
    for (int i = L; i < Math.min(L + 2019, R); i++) {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    }
    System.out.println(ans);
  } main {
    Scanner in = new Scanner(System.in);
    int L = in.nextInt(), R = in.nextInt();
    int ans = Integer.MAX_VALUE;
    for (int i = L; i < Math.min(L + 2019, R); i++) {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    }
    System.out.println(ans);
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) int L = in.nextInt() L in.nextInt() in.nextInt in R = in.nextInt(); R in.nextInt() in.nextInt in int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = L; i < Math.min(L + 2019, R); i++) {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    } int i = L; int i = L; i L i < Math.min(L + 2019, R) i Math.min(L + 2019, R) Math.min Math L + 2019 L 2019 R i++ i++ i {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    } {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    } for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= Math.min(L + 2019, R) j Math.min(L + 2019, R) Math.min Math L + 2019 L 2019 R j++ j++ j {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      } {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      } ans = Math.min(ans, (int) (((long) i * (long) j) % 2019)) ans Math.min(ans, (int) (((long) i * (long) j) % 2019)) Math.min Math ans (int) (((long) i * (long) j) % 2019) ((long) i * (long) j) (long) i (long) j 2019 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
  public static void main(String[] args) throws Exception {
    Scanner in = new Scanner(System.in);
    int L = in.nextInt(), R = in.nextInt();
    int ans = Integer.MAX_VALUE;
    for (int i = L; i < Math.min(L + 2019, R); i++) {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    }
    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) throws Exception {
    Scanner in = new Scanner(System.in);
    int L = in.nextInt(), R = in.nextInt();
    int ans = Integer.MAX_VALUE;
    for (int i = L; i < Math.min(L + 2019, R); i++) {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    }
    System.out.println(ans);
  }
} Main
import java.util.*;
import java.util.stream.*;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner in = new Scanner(System.in);
    int L = in.nextInt(), R = in.nextInt();
    int ans = Integer.MAX_VALUE;
    for (int i = L; i < Math.min(L + 2019, R); i++) {
      for (int j = i + 1; j <= Math.min(L + 2019, R); j++) {
        ans = Math.min(ans, (int) (((long) i * (long) j) % 2019));
      }
    }
    System.out.println(ans);
  }
}