import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int L = scanner.nextInt();
    int R = scanner.nextInt();
    int l = L % 2019;
    int r = R % 2019;
    if (l >= r || R - L > 2019) {
      System.out.println(0);
      return;
    }

    int min = l * r % 2019;
    for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    }
    System.out.println(min);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int L = scanner.nextInt();
    int R = scanner.nextInt();
    int l = L % 2019;
    int r = R % 2019;
    if (l >= r || R - L > 2019) {
      System.out.println(0);
      return;
    }

    int min = l * r % 2019;
    for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    }
    System.out.println(min);
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int L = scanner.nextInt();
    int R = scanner.nextInt();
    int l = L % 2019;
    int r = R % 2019;
    if (l >= r || R - L > 2019) {
      System.out.println(0);
      return;
    }

    int min = l * r % 2019;
    for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    }
    System.out.println(min);
  } main {
    Scanner scanner = new Scanner(System.in);

    int L = scanner.nextInt();
    int R = scanner.nextInt();
    int l = L % 2019;
    int r = R % 2019;
    if (l >= r || R - L > 2019) {
      System.out.println(0);
      return;
    }

    int min = l * r % 2019;
    for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    }
    System.out.println(min);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int L = scanner.nextInt(); L scanner.nextInt() scanner.nextInt scanner int R = scanner.nextInt(); R scanner.nextInt() scanner.nextInt scanner int l = L % 2019; l L % 2019 L 2019 int r = R % 2019; r R % 2019 R 2019 if (l >= r || R - L > 2019) {
      System.out.println(0);
      return;
    } l >= r || R - L > 2019 l >= r l r R - L > 2019 R - L R L 2019 {
      System.out.println(0);
      return;
    } System.out.println(0) System.out.println System.out System System.out 0 return; int min = l * r % 2019; min l * r % 2019 l * r l r 2019 for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    } int i = l; int i = l; i l i < r i r i++ i++ i {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    } {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    } for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
        min = Math.min(min, i * j % 2019);
      } {
        min = Math.min(min, i * j % 2019);
      } min = Math.min(min, i * j % 2019) min Math.min(min, i * j % 2019) Math.min Math min i * j % 2019 i * j i j 2019 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 scanner = new Scanner(System.in);

    int L = scanner.nextInt();
    int R = scanner.nextInt();
    int l = L % 2019;
    int r = R % 2019;
    if (l >= r || R - L > 2019) {
      System.out.println(0);
      return;
    }

    int min = l * r % 2019;
    for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    }
    System.out.println(min);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int L = scanner.nextInt();
    int R = scanner.nextInt();
    int l = L % 2019;
    int r = R % 2019;
    if (l >= r || R - L > 2019) {
      System.out.println(0);
      return;
    }

    int min = l * r % 2019;
    for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    }
    System.out.println(min);
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int L = scanner.nextInt();
    int R = scanner.nextInt();
    int l = L % 2019;
    int r = R % 2019;
    if (l >= r || R - L > 2019) {
      System.out.println(0);
      return;
    }

    int min = l * r % 2019;
    for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    }
    System.out.println(min);
  }
}
