import java.util.*;
class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int mod = 2019;
        int L = sc.nextInt();
        int R = sc.nextInt();
        int l = L%mod;
        int r = R%mod;
        int result = 2019;
        if(R-L>=mod){
            System.out.println(0);
            return;
        }
        if(l>r){
            System.out.println(0);
            return;
        }
        for(int i=l;i<=r;i++){
            for(int j=i+1;j<=r;j++){
                result = Math.min((i*j)%mod, result);
            }
        }
        result = result%mod;
        System.out.println(result);
    }
} import java.util.*; util.* java class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int mod = 2019;
        int L = sc.nextInt();
        int R = sc.nextInt();
        int l = L%mod;
        int r = R%mod;
        int result = 2019;
        if(R-L>=mod){
            System.out.println(0);
            return;
        }
        if(l>r){
            System.out.println(0);
            return;
        }
        for(int i=l;i<=r;i++){
            for(int j=i+1;j<=r;j++){
                result = Math.min((i*j)%mod, result);
            }
        }
        result = result%mod;
        System.out.println(result);
    }
} Main public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int mod = 2019;
        int L = sc.nextInt();
        int R = sc.nextInt();
        int l = L%mod;
        int r = R%mod;
        int result = 2019;
        if(R-L>=mod){
            System.out.println(0);
            return;
        }
        if(l>r){
            System.out.println(0);
            return;
        }
        for(int i=l;i<=r;i++){
            for(int j=i+1;j<=r;j++){
                result = Math.min((i*j)%mod, result);
            }
        }
        result = result%mod;
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
        int mod = 2019;
        int L = sc.nextInt();
        int R = sc.nextInt();
        int l = L%mod;
        int r = R%mod;
        int result = 2019;
        if(R-L>=mod){
            System.out.println(0);
            return;
        }
        if(l>r){
            System.out.println(0);
            return;
        }
        for(int i=l;i<=r;i++){
            for(int j=i+1;j<=r;j++){
                result = Math.min((i*j)%mod, result);
            }
        }
        result = result%mod;
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int mod = 2019; mod 2019 int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc int R = sc.nextInt(); R sc.nextInt() sc.nextInt sc int l = L%mod; l L%mod L mod int r = R%mod; r R%mod R mod int result = 2019; result 2019 if(R-L>=mod){
            System.out.println(0);
            return;
        } R-L>=mod R-L R L mod {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; if(l>r){
            System.out.println(0);
            return;
        } l>r l r {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; for(int i=l;i<=r;i++){
            for(int j=i+1;j<=r;j++){
                result = Math.min((i*j)%mod, result);
            }
        } int i=l; int i=l; i l i<=r i r i++ i++ i {
            for(int j=i+1;j<=r;j++){
                result = Math.min((i*j)%mod, result);
            }
        } {
            for(int j=i+1;j<=r;j++){
                result = Math.min((i*j)%mod, result);
            }
        } for(int j=i+1;j<=r;j++){
                result = Math.min((i*j)%mod, result);
            } int j=i+1; int j=i+1; j i+1 i 1 j<=r j r j++ j++ j {
                result = Math.min((i*j)%mod, result);
            } {
                result = Math.min((i*j)%mod, result);
            } result = Math.min((i*j)%mod, result) result Math.min((i*j)%mod, result) Math.min Math (i*j)%mod (i*j) i j mod result result = result%mod result result%mod result mod System.out.println(result) System.out.println System.out System System.out result String argv[] argv
import java.util.*;
class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int mod = 2019;
        int L = sc.nextInt();
        int R = sc.nextInt();
        int l = L%mod;
        int r = R%mod;
        int result = 2019;
        if(R-L>=mod){
            System.out.println(0);
            return;
        }
        if(l>r){
            System.out.println(0);
            return;
        }
        for(int i=l;i<=r;i++){
            for(int j=i+1;j<=r;j++){
                result = Math.min((i*j)%mod, result);
            }
        }
        result = result%mod;
        System.out.println(result);
    }
}