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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Long.parseLong(st.nextToken());
        long r = Long.parseLong(st.nextToken());
        if (r - l > 2019) {
            System.out.println("0");
            return;
        }
        long res = Integer.MAX_VALUE;
        for (long i = l; i <= r; i++) {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        }
        System.out.println(res);
    }

}
/*

 */ import java.io.*; io.* java import java.util.*; util.* java public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Long.parseLong(st.nextToken());
        long r = Long.parseLong(st.nextToken());
        if (r - l > 2019) {
            System.out.println("0");
            return;
        }
        long res = Integer.MAX_VALUE;
        for (long i = l; i <= r; i++) {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        }
        System.out.println(res);
    }

} Main public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Long.parseLong(st.nextToken());
        long r = Long.parseLong(st.nextToken());
        if (r - l > 2019) {
            System.out.println("0");
            return;
        }
        long res = Integer.MAX_VALUE;
        for (long i = l; i <= r; i++) {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        }
        System.out.println(res);
    } main {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Long.parseLong(st.nextToken());
        long r = Long.parseLong(st.nextToken());
        if (r - l > 2019) {
            System.out.println("0");
            return;
        }
        long res = Integer.MAX_VALUE;
        for (long i = l; i <= r; i++) {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        }
        System.out.println(res);
    } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(in.readLine()); st new StringTokenizer(in.readLine()) long l = Long.parseLong(st.nextToken()); l Long.parseLong(st.nextToken()) Long.parseLong Long st.nextToken() st.nextToken st long r = Long.parseLong(st.nextToken()); r Long.parseLong(st.nextToken()) Long.parseLong Long st.nextToken() st.nextToken st if (r - l > 2019) {
            System.out.println("0");
            return;
        } r - l > 2019 r - l r l 2019 {
            System.out.println("0");
            return;
        } System.out.println("0") System.out.println System.out System System.out "0" return; long res = Integer.MAX_VALUE; res Integer.MAX_VALUE Integer Integer.MAX_VALUE for (long i = l; i <= r; i++) {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        } long i = l; long i = l; i l i <= r i r i++ i++ i {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        } {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        } for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            } long j = l; long j = l; j l j <= r j r j++ j++ j {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            } {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            } if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                } i != j i j {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                } long x = (i * j) % 2019; x (i * j) % 2019 (i * j) i j 2019 if (x < res) {
                        res = x;
                    } x < res x res {
                        res = x;
                    } res = x res x 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) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Long.parseLong(st.nextToken());
        long r = Long.parseLong(st.nextToken());
        if (r - l > 2019) {
            System.out.println("0");
            return;
        }
        long res = Integer.MAX_VALUE;
        for (long i = l; i <= r; i++) {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        }
        System.out.println(res);
    }

} public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Long.parseLong(st.nextToken());
        long r = Long.parseLong(st.nextToken());
        if (r - l > 2019) {
            System.out.println("0");
            return;
        }
        long res = Integer.MAX_VALUE;
        for (long i = l; i <= r; i++) {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        }
        System.out.println(res);
    }

} Main
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Long.parseLong(st.nextToken());
        long r = Long.parseLong(st.nextToken());
        if (r - l > 2019) {
            System.out.println("0");
            return;
        }
        long res = Integer.MAX_VALUE;
        for (long i = l; i <= r; i++) {
            for (long j = l; j <= r; j++) {
                if (i != j) {
                    long x = (i * j) % 2019;
                    if (x < res) {
                        res = x;
                    }
                }
            }
        }
        System.out.println(res);
    }

}
/*

 */