import java.util.Scanner;

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

class Main {
  private static final int mod = 2019;
  private static void solve(long l, long r) {
    if (r - l >= 2018) {
      System.out.println(0);
      return;
    }
    Long min = null;
    for (long i = l; i <= r; i++) {
      for (long j = i + 1; j <= r; j++) {
        long m = (i * j) % mod;
        if (min == null || min > m) min = m;
      }
    }
    System.out.println(min);
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    solve(l, r);
  }
}