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