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;
        if( (R-L) >= 2019)
            min = 0;
        else  {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        }
        System.out.println(min);
        sc.close();
    }
} 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;
        if( (R-L) >= 2019)
            min = 0;
        else  {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        }
        System.out.println(min);
        sc.close();
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        int L = sc.nextInt();
        int R = sc.nextInt();

        int min = 2019;
        if( (R-L) >= 2019)
            min = 0;
        else  {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        }
        System.out.println(min);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int L = sc.nextInt();
        int R = sc.nextInt();

        int min = 2019;
        if( (R-L) >= 2019)
            min = 0;
        else  {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        }
        System.out.println(min);
        sc.close();
    } 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; min 2019 if( (R-L) >= 2019)
            min = 0;
        else  {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        } (R-L) >= 2019 (R-L) R L 2019 min = 0 min 0 {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        } for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            } int i = 0; int i = 0; i 0 i <= (R-L+-1) i (R-L+-1) R-L R L -1 1 i++ i++ i {
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            } {
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            } for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                } int j = i+1; int j = i+1; j i+1 i 1 j <= (R-L) j (R-L) R L j++ j++ j {
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                } {
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                } int mod_i = (L+i) % 2019; mod_i (L+i) % 2019 (L+i) L i 2019 int mod_j = (L+j) % 2019; mod_j (L+j) % 2019 (L+j) L j 2019 int mod_ij = (mod_i * mod_j) % 2019; mod_ij (mod_i * mod_j) % 2019 (mod_i * mod_j) mod_i mod_j 2019 if(mod_ij < min)
                        min = mod_ij; mod_ij < min mod_ij min min = mod_ij min mod_ij System.out.println(min) System.out.println System.out System System.out min sc.close() sc.close sc 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;
        if( (R-L) >= 2019)
            min = 0;
        else  {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        }
        System.out.println(min);
        sc.close();
    }
} 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;
        if( (R-L) >= 2019)
            min = 0;
        else  {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        }
        System.out.println(min);
        sc.close();
    }
} 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;
        if( (R-L) >= 2019)
            min = 0;
        else  {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        }
        System.out.println(min);
        sc.close();
    }
}