import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong(), r = sc.nextLong();
        long res = Long.MAX_VALUE;
        r = Math.min(l + 2019L, r);
        for(long i = l; i <= r; i++) {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        }
        System.out.println(res);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong(), r = sc.nextLong();
        long res = Long.MAX_VALUE;
        r = Math.min(l + 2019L, r);
        for(long i = l; i <= r; i++) {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        }
        System.out.println(res);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong(), r = sc.nextLong();
        long res = Long.MAX_VALUE;
        r = Math.min(l + 2019L, r);
        for(long i = l; i <= r; i++) {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        }
        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong(), r = sc.nextLong();
        long res = Long.MAX_VALUE;
        r = Math.min(l + 2019L, r);
        for(long i = l; i <= r; i++) {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        }
        System.out.println(res);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextLong() l sc.nextLong() sc.nextLong sc r = sc.nextLong(); r sc.nextLong() sc.nextLong sc long res = Long.MAX_VALUE; res Long.MAX_VALUE Long Long.MAX_VALUE r = Math.min(l + 2019L, r) r Math.min(l + 2019L, r) Math.min Math l + 2019L l 2019L r for(long i = l; i <= r; i++) {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        } long i = l; long i = l; i l i <= r i r i++ i++ i {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        } {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        } for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
                res = Math.min(res, (i * j) % 2019L);
            } {
                res = Math.min(res, (i * j) % 2019L);
            } res = Math.min(res, (i * j) % 2019L) res Math.min(res, (i * j) % 2019L) Math.min Math res (i * j) % 2019L (i * j) i j 2019L System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong(), r = sc.nextLong();
        long res = Long.MAX_VALUE;
        r = Math.min(l + 2019L, r);
        for(long i = l; i <= r; i++) {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        }
        System.out.println(res);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong(), r = sc.nextLong();
        long res = Long.MAX_VALUE;
        r = Math.min(l + 2019L, r);
        for(long i = l; i <= r; i++) {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        }
        System.out.println(res);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong(), r = sc.nextLong();
        long res = Long.MAX_VALUE;
        r = Math.min(l + 2019L, r);
        for(long i = l; i <= r; i++) {
            for(long j = i + 1; j <= r; j++) {
                res = Math.min(res, (i * j) % 2019L);
            }
        }
        System.out.println(res);
    }
}
