import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();

    if (r > l + 2018) {
      System.out.println(0);
      System.exit(0);
    }

    long res = 2019;

    for (long i = l; i <= r; ++i) {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    }

    System.out.println(res);
  }
} import java.util.Scanner; Scanner 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();

    if (r > l + 2018) {
      System.out.println(0);
      System.exit(0);
    }

    long res = 2019;

    for (long i = l; i <= r; ++i) {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    }

    System.out.println(res);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();

    if (r > l + 2018) {
      System.out.println(0);
      System.exit(0);
    }

    long res = 2019;

    for (long i = l; i <= r; ++i) {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    }

    System.out.println(res);
  } main {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();

    if (r > l + 2018) {
      System.out.println(0);
      System.exit(0);
    }

    long res = 2019;

    for (long i = l; i <= r; ++i) {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    }

    System.out.println(res);
  } 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 if (r > l + 2018) {
      System.out.println(0);
      System.exit(0);
    } r > l + 2018 r l + 2018 l 2018 {
      System.out.println(0);
      System.exit(0);
    } System.out.println(0) System.out.println System.out System System.out 0 System.exit(0) System.exit System 0 long res = 2019; res 2019 for (long i = l; i <= r; ++i) {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    } long i = l; long i = l; i l i <= r i r ++i ++i i {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    } {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    } for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      } long j = l; long j = l; j l j <= r j r ++j ++j j {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      } {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      } if (i == j)
          continue; i == j i j continue; res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res res ((i * j) % 2019 < res) ? (i * j) % 2019 : res ((i * j) % 2019 < res) (i * j) % 2019 (i * j) i j 2019 res (i * j) % 2019 (i * j) i j 2019 res System.out.println(res) System.out.println System.out System System.out res 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();

    if (r > l + 2018) {
      System.out.println(0);
      System.exit(0);
    }

    long res = 2019;

    for (long i = l; i <= r; ++i) {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    }

    System.out.println(res);
  }
} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();

    if (r > l + 2018) {
      System.out.println(0);
      System.exit(0);
    }

    long res = 2019;

    for (long i = l; i <= r; ++i) {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    }

    System.out.println(res);
  }
} Main
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();

    if (r > l + 2018) {
      System.out.println(0);
      System.exit(0);
    }

    long res = 2019;

    for (long i = l; i <= r; ++i) {
      for (long j = l; j <= r; ++j) {
        if (i == j)
          continue;
        res = ((i * j) % 2019 < res) ? (i * j) % 2019 : res;
      }
    }

    System.out.println(res);
  }
}