import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ins = sc.nextLine().split(" ");
        long l = Integer.parseInt(ins[0]);
        long r = Integer.parseInt(ins[1]);
        long s = l % 2019;
        long t = r % 2019;
        if (t <= s) {
            System.out.println(0);
            return;
        }
        if ((r - l) / 2019 >= 1) {
            System.out.println(0);
            return;
        }
        long result = Integer.MAX_VALUE;
        for (long i = s; i <= t; i++) {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        }
        System.out.println(result);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ins = sc.nextLine().split(" ");
        long l = Integer.parseInt(ins[0]);
        long r = Integer.parseInt(ins[1]);
        long s = l % 2019;
        long t = r % 2019;
        if (t <= s) {
            System.out.println(0);
            return;
        }
        if ((r - l) / 2019 >= 1) {
            System.out.println(0);
            return;
        }
        long result = Integer.MAX_VALUE;
        for (long i = s; i <= t; i++) {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        }
        System.out.println(result);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ins = sc.nextLine().split(" ");
        long l = Integer.parseInt(ins[0]);
        long r = Integer.parseInt(ins[1]);
        long s = l % 2019;
        long t = r % 2019;
        if (t <= s) {
            System.out.println(0);
            return;
        }
        if ((r - l) / 2019 >= 1) {
            System.out.println(0);
            return;
        }
        long result = Integer.MAX_VALUE;
        for (long i = s; i <= t; i++) {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        }
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
        String[] ins = sc.nextLine().split(" ");
        long l = Integer.parseInt(ins[0]);
        long r = Integer.parseInt(ins[1]);
        long s = l % 2019;
        long t = r % 2019;
        if (t <= s) {
            System.out.println(0);
            return;
        }
        if ((r - l) / 2019 >= 1) {
            System.out.println(0);
            return;
        }
        long result = Integer.MAX_VALUE;
        for (long i = s; i <= t; i++) {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        }
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] ins = sc.nextLine().split(" "); ins sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " long l = Integer.parseInt(ins[0]); l Integer.parseInt(ins[0]) Integer.parseInt Integer ins[0] ins 0 long r = Integer.parseInt(ins[1]); r Integer.parseInt(ins[1]) Integer.parseInt Integer ins[1] ins 1 long s = l % 2019; s l % 2019 l 2019 long t = r % 2019; t r % 2019 r 2019 if (t <= s) {
            System.out.println(0);
            return;
        } t <= s t s {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; if ((r - l) / 2019 >= 1) {
            System.out.println(0);
            return;
        } (r - l) / 2019 >= 1 (r - l) / 2019 (r - l) r l 2019 1 {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; long result = Integer.MAX_VALUE; result Integer.MAX_VALUE Integer Integer.MAX_VALUE for (long i = s; i <= t; i++) {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        } long i = s; long i = s; i s i <= t i t i++ i++ i {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        } {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        } for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= t j t j++ j++ j {
                result = Math.min(result, (i * j) % 2019);
            } {
                result = Math.min(result, (i * j) % 2019);
            } result = Math.min(result, (i * j) % 2019) result Math.min(result, (i * j) % 2019) Math.min Math result (i * j) % 2019 (i * j) i j 2019 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ins = sc.nextLine().split(" ");
        long l = Integer.parseInt(ins[0]);
        long r = Integer.parseInt(ins[1]);
        long s = l % 2019;
        long t = r % 2019;
        if (t <= s) {
            System.out.println(0);
            return;
        }
        if ((r - l) / 2019 >= 1) {
            System.out.println(0);
            return;
        }
        long result = Integer.MAX_VALUE;
        for (long i = s; i <= t; i++) {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        }
        System.out.println(result);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ins = sc.nextLine().split(" ");
        long l = Integer.parseInt(ins[0]);
        long r = Integer.parseInt(ins[1]);
        long s = l % 2019;
        long t = r % 2019;
        if (t <= s) {
            System.out.println(0);
            return;
        }
        if ((r - l) / 2019 >= 1) {
            System.out.println(0);
            return;
        }
        long result = Integer.MAX_VALUE;
        for (long i = s; i <= t; i++) {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        }
        System.out.println(result);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ins = sc.nextLine().split(" ");
        long l = Integer.parseInt(ins[0]);
        long r = Integer.parseInt(ins[1]);
        long s = l % 2019;
        long t = r % 2019;
        if (t <= s) {
            System.out.println(0);
            return;
        }
        if ((r - l) / 2019 >= 1) {
            System.out.println(0);
            return;
        }
        long result = Integer.MAX_VALUE;
        for (long i = s; i <= t; i++) {
            for (long j = i + 1; j <= t; j++) {
                result = Math.min(result, (i * j) % 2019);
            }
        }
        System.out.println(result);
    }
}