import java.util.Scanner;

class Solver{

    private final int L;
    private final int R;

    Solver(Scanner in){
        L = in.nextInt();
        R = in.nextInt();
    }

    void solve(){
        if(R - L >= 2019){
            System.out.println(0);
            return;
        }
        int l = L % 2019;
        int r = R % 2019;
        int min = 2019;
        for(int i = l; i <= r; i++){
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        }
        System.out.println(min);
    }
}

class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        new Solver(in).solve();

        in.close();
    }
} import java.util.Scanner; Scanner java.util class Solver{

    private final int L;
    private final int R;

    Solver(Scanner in){
        L = in.nextInt();
        R = in.nextInt();
    }

    void solve(){
        if(R - L >= 2019){
            System.out.println(0);
            return;
        }
        int l = L % 2019;
        int r = R % 2019;
        int min = 2019;
        for(int i = l; i <= r; i++){
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        }
        System.out.println(min);
    }
} Solver private final int L; L private final int R; R Solver(Scanner in){
        L = in.nextInt();
        R = in.nextInt();
    } Solver {
        L = in.nextInt();
        R = in.nextInt();
    } L = in.nextInt() L in.nextInt() in.nextInt in R = in.nextInt() R in.nextInt() in.nextInt in Scanner in in void solve(){
        if(R - L >= 2019){
            System.out.println(0);
            return;
        }
        int l = L % 2019;
        int r = R % 2019;
        int min = 2019;
        for(int i = l; i <= r; i++){
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        }
        System.out.println(min);
    } solve {
        if(R - L >= 2019){
            System.out.println(0);
            return;
        }
        int l = L % 2019;
        int r = R % 2019;
        int min = 2019;
        for(int i = l; i <= r; i++){
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        }
        System.out.println(min);
    } 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; int l = L % 2019; l L % 2019 L 2019 int r = R % 2019; r R % 2019 R 2019 int min = 2019; min 2019 for(int i = l; i <= r; i++){
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        } int i = l; int i = l; i l i <= r i r i++ i++ i {
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        } {
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        } for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
                min = Math.min(min, i * j % 2019);
            } {
                min = Math.min(min, i * j % 2019);
            } min = Math.min(min, i * j % 2019) min Math.min(min, i * j % 2019) Math.min Math min i * j % 2019 i * j i j 2019 System.out.println(min) System.out.println System.out System System.out min class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        new Solver(in).solve();

        in.close();
    }
} Main public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        new Solver(in).solve();

        in.close();
    } main {
        Scanner in = new Scanner(System.in);

        new Solver(in).solve();

        in.close();
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) new Solver(in).solve() new Solver(in).solve new Solver(in) in.close() in.close in String[] args args
import java.util.Scanner;

class Solver{

    private final int L;
    private final int R;

    Solver(Scanner in){
        L = in.nextInt();
        R = in.nextInt();
    }

    void solve(){
        if(R - L >= 2019){
            System.out.println(0);
            return;
        }
        int l = L % 2019;
        int r = R % 2019;
        int min = 2019;
        for(int i = l; i <= r; i++){
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        }
        System.out.println(min);
    }
}

class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        new Solver(in).solve();

        in.close();
    }
}