import java.util.Scanner;

import static java.lang.Math.min;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long minValue = 2018;
        long v;
        long i,j;

//        System.out.println(l + " : " + r);

        r = min(r, l+4038);
        i=0;j=0;
        for(i=l;i<r;i++) {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        }
//        System.out.println("[" + i + ", " + j + "]");
        // 出力
        System.out.println((int)minValue);
    }
} import java.util.Scanner; Scanner java.util import static java.lang.Math.min; import static java.lang.Math.min; import static java.lang.Math.min; public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long minValue = 2018;
        long v;
        long i,j;

//        System.out.println(l + " : " + r);

        r = min(r, l+4038);
        i=0;j=0;
        for(i=l;i<r;i++) {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        }
//        System.out.println("[" + i + ", " + j + "]");
        // 出力
        System.out.println((int)minValue);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long minValue = 2018;
        long v;
        long i,j;

//        System.out.println(l + " : " + r);

        r = min(r, l+4038);
        i=0;j=0;
        for(i=l;i<r;i++) {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        }
//        System.out.println("[" + i + ", " + j + "]");
        // 出力
        System.out.println((int)minValue);
    } main {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long minValue = 2018;
        long v;
        long i,j;

//        System.out.println(l + " : " + r);

        r = min(r, l+4038);
        i=0;j=0;
        for(i=l;i<r;i++) {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        }
//        System.out.println("[" + i + ", " + j + "]");
        // 出力
        System.out.println((int)minValue);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextInt(); l sc.nextInt() sc.nextInt sc long r = sc.nextInt(); r sc.nextInt() sc.nextInt sc long minValue = 2018; minValue 2018 long v; v long i i j; j r = min(r, l+4038) r min(r, l+4038) min r l+4038 l 4038 i=0 i 0 j=0 j 0 for(i=l;i<r;i++) {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        } i=l; i=l i l i<r i r i++ i++ i {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        } {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        } for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            } j=i+1; j=i+1 j i+1 i 1 j<=r j r j++ j++ j {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            } {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            } v = (i*j)%2019 v (i*j)%2019 (i*j) i j 2019 minValue = min(minValue, v) minValue min(minValue, v) min minValue v if (minValue == 0) { break; } minValue == 0 minValue 0 { break; } break; if (minValue == 0) { break; } minValue == 0 minValue 0 { break; } break; System.out.println((int)minValue) System.out.println System.out System System.out (int)minValue String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long minValue = 2018;
        long v;
        long i,j;

//        System.out.println(l + " : " + r);

        r = min(r, l+4038);
        i=0;j=0;
        for(i=l;i<r;i++) {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        }
//        System.out.println("[" + i + ", " + j + "]");
        // 出力
        System.out.println((int)minValue);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long minValue = 2018;
        long v;
        long i,j;

//        System.out.println(l + " : " + r);

        r = min(r, l+4038);
        i=0;j=0;
        for(i=l;i<r;i++) {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        }
//        System.out.println("[" + i + ", " + j + "]");
        // 出力
        System.out.println((int)minValue);
    }
} Main
import java.util.Scanner;

import static java.lang.Math.min;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long minValue = 2018;
        long v;
        long i,j;

//        System.out.println(l + " : " + r);

        r = min(r, l+4038);
        i=0;j=0;
        for(i=l;i<r;i++) {
            for(j=i+1;j<=r;j++) {
                v = (i*j)%2019;
//                v = floorMod(((long)l*(long)j), 2019);

//                System.out.println("[" + i + ", " + j + "] " + v);
                minValue = min(minValue, v);
                if (minValue == 0) { break; }
            }
            if (minValue == 0) { break; }
        }
//        System.out.println("[" + i + ", " + j + "]");
        // 出力
        System.out.println((int)minValue);
    }
}