import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long l = sc.nextLong();
        long r = sc.nextLong();
        if (r - l >= 2019) {
            System.out.println(0);
        } else {
            long min = 100000;
            for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            }
            System.out.println(min);
        }
    }

} import java.util.Scanner; Scanner java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Arrays; Arrays java.util import java.util.ArrayList; ArrayList java.util import java.lang.Math; Math java.lang public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long l = sc.nextLong();
        long r = sc.nextLong();
        if (r - l >= 2019) {
            System.out.println(0);
        } else {
            long min = 100000;
            for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            }
            System.out.println(min);
        }
    }

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        long l = sc.nextLong();
        long r = sc.nextLong();
        if (r - l >= 2019) {
            System.out.println(0);
        } else {
            long min = 100000;
            for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            }
            System.out.println(min);
        }
    } main {
        long l = sc.nextLong();
        long r = sc.nextLong();
        if (r - l >= 2019) {
            System.out.println(0);
        } else {
            long min = 100000;
            for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            }
            System.out.println(min);
        }
    } long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc if (r - l >= 2019) {
            System.out.println(0);
        } else {
            long min = 100000;
            for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            }
            System.out.println(min);
        } r - l >= 2019 r - l r l 2019 {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 {
            long min = 100000;
            for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            }
            System.out.println(min);
        } long min = 100000; min 100000 for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            } long i = l; long i = l; i l i <= r-1 i r-1 r 1 i++ i++ i {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            } {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            } for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                } long j = i+1; long j = i+1; j i+1 i 1 j <= r j r j++ j++ j {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                } {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                } long tmp = ((i % 2019) * (j % 2019)) % 2019; tmp ((i % 2019) * (j % 2019)) % 2019 ((i % 2019) * (j % 2019)) (i % 2019) i 2019 (j % 2019) j 2019 2019 if (tmp < min) {
                        min = tmp;
                    } tmp < min tmp min {
                        min = tmp;
                    } min = tmp min tmp System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long l = sc.nextLong();
        long r = sc.nextLong();
        if (r - l >= 2019) {
            System.out.println(0);
        } else {
            long min = 100000;
            for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            }
            System.out.println(min);
        }
    }

} public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long l = sc.nextLong();
        long r = sc.nextLong();
        if (r - l >= 2019) {
            System.out.println(0);
        } else {
            long min = 100000;
            for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            }
            System.out.println(min);
        }
    }

} Main
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long l = sc.nextLong();
        long r = sc.nextLong();
        if (r - l >= 2019) {
            System.out.println(0);
        } else {
            long min = 100000;
            for (long i = l; i <= r-1; i++) {
                for (long j = i+1; j <= r; j++) {
                    long tmp = ((i % 2019) * (j % 2019)) % 2019;
                    if (tmp < min) {
                        min = tmp;
                    }
                }
            }
            System.out.println(min);
        }
    }

}
