import java.util.*;
import java.io.*;

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

        if (b - a >= 2019) System.out.println(0);
        else {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

            System.out.println(min);
        }
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        if (b - a >= 2019) System.out.println(0);
        else {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

            System.out.println(min);
        }
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        if (b - a >= 2019) System.out.println(0);
        else {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

            System.out.println(min);
        }
    } main {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        if (b - a >= 2019) System.out.println(0);
        else {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

            System.out.println(min);
        }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) long a = in.nextLong(); a in.nextLong() in.nextLong in long b = in.nextLong(); b in.nextLong() in.nextLong in if (b - a >= 2019) System.out.println(0);
        else {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

            System.out.println(min);
        } b - a >= 2019 b - a b a 2019 System.out.println(0) System.out.println System.out System System.out 0 {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

            System.out.println(min);
        } long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            } long i = a; long i = a; i a i <= b i b ++i ++i i {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            } {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            } for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= b j b ++j ++j j {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                } {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                } min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019) min Math.min(min, ((i % 2019) * (j % 2019)) % 2019) Math.min Math min ((i % 2019) * (j % 2019)) % 2019 ((i % 2019) * (j % 2019)) (i % 2019) i 2019 (j % 2019) j 2019 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 in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        if (b - a >= 2019) System.out.println(0);
        else {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

            System.out.println(min);
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();

        if (b - a >= 2019) System.out.println(0);
        else {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

            System.out.println(min);
        }
    }
} Main
import java.util.*;
import java.io.*;

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

        if (b - a >= 2019) System.out.println(0);
        else {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

            System.out.println(min);
        }
    }
}