import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int min = 2019*2019;
    for(int i=l;i<=r&&i<=l+2019;i++){
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    }
    System.out.println( min );
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int min = 2019*2019;
    for(int i=l;i<=r&&i<=l+2019;i++){
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    }
    System.out.println( min );
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int min = 2019*2019;
    for(int i=l;i<=r&&i<=l+2019;i++){
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    }
    System.out.println( min );
  } main {
    Scanner sc = new Scanner(System.in);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int min = 2019*2019;
    for(int i=l;i<=r&&i<=l+2019;i++){
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    }
    System.out.println( min );
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l=sc.nextInt(); l sc.nextInt() sc.nextInt sc int r=sc.nextInt(); r sc.nextInt() sc.nextInt sc int min = 2019*2019; min 2019*2019 2019 2019 for(int i=l;i<=r&&i<=l+2019;i++){
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    } int i=l; int i=l; i l i<=r&&i<=l+2019 i<=r i r i<=l+2019 i l+2019 l 2019 i++ i++ i {
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    } {
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    } for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        } int j=i+1; int j=i+1; j i+1 i 1 j<=r&&j<=i+2019 j<=r j r j<=i+2019 j i+2019 i 2019 j++ j++ j {
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        } {
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        } min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min) min Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min) Math.min Math ( ((i%2019)*(j%2019))%2019 ) ((i%2019)*(j%2019)) (i%2019) i 2019 (j%2019) j 2019 2019 min 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);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int min = 2019*2019;
    for(int i=l;i<=r&&i<=l+2019;i++){
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    }
    System.out.println( min );
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int min = 2019*2019;
    for(int i=l;i<=r&&i<=l+2019;i++){
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    }
    System.out.println( min );
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int l=sc.nextInt();
    int r=sc.nextInt();
    int min = 2019*2019;
    for(int i=l;i<=r&&i<=l+2019;i++){
        for(int j=i+1;j<=r&&j<=i+2019;j++){
            min=Math.min( ( ((i%2019)*(j%2019))%2019 ) ,min);
        }
    }
    System.out.println( min );
  }
}
