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();
    long ans = 0;
    if((r - l) <= 2019) {
      long t = 2019;
      for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      }
      ans = t;
    }
    System.out.println(ans);
  }
} 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();
    long ans = 0;
    if((r - l) <= 2019) {
      long t = 2019;
      for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      }
      ans = t;
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    long ans = 0;
    if((r - l) <= 2019) {
      long t = 2019;
      for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      }
      ans = t;
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    long ans = 0;
    if((r - l) <= 2019) {
      long t = 2019;
      for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      }
      ans = t;
    }
    System.out.println(ans);
  } 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 long ans = 0; ans 0 if((r - l) <= 2019) {
      long t = 2019;
      for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      }
      ans = t;
    } (r - l) <= 2019 (r - l) r l 2019 {
      long t = 2019;
      for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      }
      ans = t;
    } long t = 2019; t 2019 for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      } long i = l; long i = l; i l i < r i r i++ i++ i {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      } {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      } for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        } {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        } long i2 = (i % 2019); i2 (i % 2019) i 2019 long j2 = (j % 2019); j2 (j % 2019) j 2019 t = Math.min(t, (i2 * j2) % 2019) t Math.min(t, (i2 * j2) % 2019) Math.min Math t (i2 * j2) % 2019 (i2 * j2) i2 j2 2019 ans = t ans t 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) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    long ans = 0;
    if((r - l) <= 2019) {
      long t = 2019;
      for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      }
      ans = t;
    }
    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    long ans = 0;
    if((r - l) <= 2019) {
      long t = 2019;
      for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      }
      ans = t;
    }
    System.out.println(ans);
  }
} 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();
    long ans = 0;
    if((r - l) <= 2019) {
      long t = 2019;
      for(long i = l; i < r; i++) {
        for(long j = i + 1; j <= r; j++) {
          long i2 = (i % 2019);
          long j2 = (j % 2019);
          t = Math.min(t, (i2 * j2) % 2019);
        }
      }
      ans = t;
    }
    System.out.println(ans);
  }
}
