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

public class Main {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);


        int l = in.nextInt();
        int r = in.nextInt();
        long min = Long.MAX_VALUE;
        HashSet<Integer> set = new HashSet<>();
        for (int i = l; i <=r; i++) {
            set.add(i%2019);
            if(set.size() == 2019) break;
        }
        int [] a = new int[set.size()];
        int index = 0;
        for(int i : set) {
            a[index++] = i;
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        }
        out.println(min);

       /* min = Integer.MAX_VALUE;
        for (long i = l; i <=r; i++) {
            for (long j = i+1; j <=r; j++) {
                min = Math.min(min,(i*j)%2019);
            }
        }
        out.println(min);*/
        out.flush();
    }
    static double distance(int [] a, int [] b) {
        double d = 0;
        for (int i = 0; i < a.length; i++) {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        }
        return Math.sqrt(d);
    }
    static boolean isInteger(double d) {
        return d == (int)d;
    }
    static int f(LinkedList<Integer> q) {
        int size = q.size();
        int count = 0;
        size/=2;
        while (size-->0) {
            int first = q.pollFirst();
            int second = q.pollFirst();
            if(first+second>=10) count++;
            int newValue = (first+second)%10;
            q.addLast(newValue);
        }
        return count;
    }
}

class InputReader extends BufferedReader {
    StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    }

    public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.valueOf(next());
    }
    public Long nextLong() {return  Long.valueOf(next());}

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);


        int l = in.nextInt();
        int r = in.nextInt();
        long min = Long.MAX_VALUE;
        HashSet<Integer> set = new HashSet<>();
        for (int i = l; i <=r; i++) {
            set.add(i%2019);
            if(set.size() == 2019) break;
        }
        int [] a = new int[set.size()];
        int index = 0;
        for(int i : set) {
            a[index++] = i;
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        }
        out.println(min);

       /* min = Integer.MAX_VALUE;
        for (long i = l; i <=r; i++) {
            for (long j = i+1; j <=r; j++) {
                min = Math.min(min,(i*j)%2019);
            }
        }
        out.println(min);*/
        out.flush();
    }
    static double distance(int [] a, int [] b) {
        double d = 0;
        for (int i = 0; i < a.length; i++) {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        }
        return Math.sqrt(d);
    }
    static boolean isInteger(double d) {
        return d == (int)d;
    }
    static int f(LinkedList<Integer> q) {
        int size = q.size();
        int count = 0;
        size/=2;
        while (size-->0) {
            int first = q.pollFirst();
            int second = q.pollFirst();
            if(first+second>=10) count++;
            int newValue = (first+second)%10;
            q.addLast(newValue);
        }
        return count;
    }
} Main public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);


        int l = in.nextInt();
        int r = in.nextInt();
        long min = Long.MAX_VALUE;
        HashSet<Integer> set = new HashSet<>();
        for (int i = l; i <=r; i++) {
            set.add(i%2019);
            if(set.size() == 2019) break;
        }
        int [] a = new int[set.size()];
        int index = 0;
        for(int i : set) {
            a[index++] = i;
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        }
        out.println(min);

       /* min = Integer.MAX_VALUE;
        for (long i = l; i <=r; i++) {
            for (long j = i+1; j <=r; j++) {
                min = Math.min(min,(i*j)%2019);
            }
        }
        out.println(min);*/
        out.flush();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);


        int l = in.nextInt();
        int r = in.nextInt();
        long min = Long.MAX_VALUE;
        HashSet<Integer> set = new HashSet<>();
        for (int i = l; i <=r; i++) {
            set.add(i%2019);
            if(set.size() == 2019) break;
        }
        int [] a = new int[set.size()];
        int index = 0;
        for(int i : set) {
            a[index++] = i;
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        }
        out.println(min);

       /* min = Integer.MAX_VALUE;
        for (long i = l; i <=r; i++) {
            for (long j = i+1; j <=r; j++) {
                min = Math.min(min,(i*j)%2019);
            }
        }
        out.println(min);*/
        out.flush();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out InputReader in = new InputReader(inputStream); in new InputReader(inputStream) InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream); out new InputReader.OutputWriter(outputStream) int l = in.nextInt(); l in.nextInt() in.nextInt in int r = in.nextInt(); r in.nextInt() in.nextInt in long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE HashSet<Integer> set = new HashSet<>(); set new HashSet<>() for (int i = l; i <=r; i++) {
            set.add(i%2019);
            if(set.size() == 2019) break;
        } int i = l; int i = l; i l i <=r i r i++ i++ i {
            set.add(i%2019);
            if(set.size() == 2019) break;
        } {
            set.add(i%2019);
            if(set.size() == 2019) break;
        } set.add(i%2019) set.add set i%2019 i 2019 if(set.size() == 2019) break; set.size() == 2019 set.size() set.size set 2019 break; int [] a = new int[set.size()]; a new int[set.size()] set.size() set.size set int index = 0; index 0 for(int i : set) {
            a[index++] = i;
        } int i set {
            a[index++] = i;
        } {
            a[index++] = i;
        } a[index++] = i a[index++] a index++ index i for (int i = 0; i < a.length; i++) {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        } {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        } for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            } int j = i+1; int j = i+1; j i+1 i 1 j < a.length j a.length a a.length j++ j++ j {
                min = Math.min(min,(a[i]*a[j])%2019);
            } {
                min = Math.min(min,(a[i]*a[j])%2019);
            } min = Math.min(min,(a[i]*a[j])%2019) min Math.min(min,(a[i]*a[j])%2019) Math.min Math min (a[i]*a[j])%2019 (a[i]*a[j]) a[i] a i a[j] a j 2019 out.println(min) out.println out min out.flush() out.flush out String[] args args static double distance(int [] a, int [] b) {
        double d = 0;
        for (int i = 0; i < a.length; i++) {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        }
        return Math.sqrt(d);
    } distance {
        double d = 0;
        for (int i = 0; i < a.length; i++) {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        }
        return Math.sqrt(d);
    } double d = 0; d 0 for (int i = 0; i < a.length; i++) {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        } {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        } int temp = (a[i]-b[i])*(a[i]-b[i]); temp (a[i]-b[i])*(a[i]-b[i]) (a[i]-b[i]) a[i] a i b[i] b i (a[i]-b[i]) a[i] a i b[i] b i d+=temp d temp return Math.sqrt(d); Math.sqrt(d) Math.sqrt Math d int [] a a int [] b b static boolean isInteger(double d) {
        return d == (int)d;
    } isInteger {
        return d == (int)d;
    } return d == (int)d; d == (int)d d (int)d double d d static int f(LinkedList<Integer> q) {
        int size = q.size();
        int count = 0;
        size/=2;
        while (size-->0) {
            int first = q.pollFirst();
            int second = q.pollFirst();
            if(first+second>=10) count++;
            int newValue = (first+second)%10;
            q.addLast(newValue);
        }
        return count;
    } f {
        int size = q.size();
        int count = 0;
        size/=2;
        while (size-->0) {
            int first = q.pollFirst();
            int second = q.pollFirst();
            if(first+second>=10) count++;
            int newValue = (first+second)%10;
            q.addLast(newValue);
        }
        return count;
    } int size = q.size(); size q.size() q.size q int count = 0; count 0 size/=2 size 2 while (size-->0) {
            int first = q.pollFirst();
            int second = q.pollFirst();
            if(first+second>=10) count++;
            int newValue = (first+second)%10;
            q.addLast(newValue);
        } size-->0 size-- size 0 {
            int first = q.pollFirst();
            int second = q.pollFirst();
            if(first+second>=10) count++;
            int newValue = (first+second)%10;
            q.addLast(newValue);
        } int first = q.pollFirst(); first q.pollFirst() q.pollFirst q int second = q.pollFirst(); second q.pollFirst() q.pollFirst q if(first+second>=10) count++; first+second>=10 first+second first second 10 count++ count int newValue = (first+second)%10; newValue (first+second)%10 (first+second) first second 10 q.addLast(newValue) q.addLast q newValue return count; count LinkedList<Integer> q q class InputReader extends BufferedReader {
    StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    }

    public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.valueOf(next());
    }
    public Long nextLong() {return  Long.valueOf(next());}

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    }
} InputReader StringTokenizer tokenizer; tokenizer public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    } InputReader {
        super(new InputStreamReader(inputStream), 32768);
    } super(new InputStreamReader(inputStream), 32768) super new InputStreamReader(inputStream) 32768 InputStream inputStream inputStream public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    } InputReader {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    } super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename))) super new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)) String filename filename public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    } next {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        } try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            } catch (IOException e) {
                throw new RuntimeException();
            } IOException e {
                throw new RuntimeException();
            } throw new RuntimeException(); new RuntimeException() {
                tokenizer = new StringTokenizer(readLine());
            } tokenizer = new StringTokenizer(readLine()) tokenizer new StringTokenizer(readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public Integer nextInt() {
        return Integer.valueOf(next());
    } nextInt {
        return Integer.valueOf(next());
    } return Integer.valueOf(next()); Integer.valueOf(next()) Integer.valueOf Integer next() next public Long nextLong() {return  Long.valueOf(next());} nextLong {return  Long.valueOf(next());} return  Long.valueOf(next()); Long.valueOf(next()) Long.valueOf Long next() next static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    } OutputWriter public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        } OutputWriter {
            super(outputStream);
        } super(outputStream) super outputStream OutputStream outputStream outputStream public OutputWriter(Writer writer) {
            super(writer);
        } OutputWriter {
            super(writer);
        } super(writer) super writer Writer writer writer public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        } OutputWriter {
            super(filename);
        } super(filename) super filename String filename filename public void close() {
            super.close();
        } close {
            super.close();
        } super.close() super.close super PrintWriter BufferedReader public class Main {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);


        int l = in.nextInt();
        int r = in.nextInt();
        long min = Long.MAX_VALUE;
        HashSet<Integer> set = new HashSet<>();
        for (int i = l; i <=r; i++) {
            set.add(i%2019);
            if(set.size() == 2019) break;
        }
        int [] a = new int[set.size()];
        int index = 0;
        for(int i : set) {
            a[index++] = i;
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        }
        out.println(min);

       /* min = Integer.MAX_VALUE;
        for (long i = l; i <=r; i++) {
            for (long j = i+1; j <=r; j++) {
                min = Math.min(min,(i*j)%2019);
            }
        }
        out.println(min);*/
        out.flush();
    }
    static double distance(int [] a, int [] b) {
        double d = 0;
        for (int i = 0; i < a.length; i++) {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        }
        return Math.sqrt(d);
    }
    static boolean isInteger(double d) {
        return d == (int)d;
    }
    static int f(LinkedList<Integer> q) {
        int size = q.size();
        int count = 0;
        size/=2;
        while (size-->0) {
            int first = q.pollFirst();
            int second = q.pollFirst();
            if(first+second>=10) count++;
            int newValue = (first+second)%10;
            q.addLast(newValue);
        }
        return count;
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);


        int l = in.nextInt();
        int r = in.nextInt();
        long min = Long.MAX_VALUE;
        HashSet<Integer> set = new HashSet<>();
        for (int i = l; i <=r; i++) {
            set.add(i%2019);
            if(set.size() == 2019) break;
        }
        int [] a = new int[set.size()];
        int index = 0;
        for(int i : set) {
            a[index++] = i;
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        }
        out.println(min);

       /* min = Integer.MAX_VALUE;
        for (long i = l; i <=r; i++) {
            for (long j = i+1; j <=r; j++) {
                min = Math.min(min,(i*j)%2019);
            }
        }
        out.println(min);*/
        out.flush();
    }
    static double distance(int [] a, int [] b) {
        double d = 0;
        for (int i = 0; i < a.length; i++) {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        }
        return Math.sqrt(d);
    }
    static boolean isInteger(double d) {
        return d == (int)d;
    }
    static int f(LinkedList<Integer> q) {
        int size = q.size();
        int count = 0;
        size/=2;
        while (size-->0) {
            int first = q.pollFirst();
            int second = q.pollFirst();
            if(first+second>=10) count++;
            int newValue = (first+second)%10;
            q.addLast(newValue);
        }
        return count;
    }
} Main
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);


        int l = in.nextInt();
        int r = in.nextInt();
        long min = Long.MAX_VALUE;
        HashSet<Integer> set = new HashSet<>();
        for (int i = l; i <=r; i++) {
            set.add(i%2019);
            if(set.size() == 2019) break;
        }
        int [] a = new int[set.size()];
        int index = 0;
        for(int i : set) {
            a[index++] = i;
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = i+1; j < a.length; j++) {
                min = Math.min(min,(a[i]*a[j])%2019);
            }
        }
        out.println(min);

       /* min = Integer.MAX_VALUE;
        for (long i = l; i <=r; i++) {
            for (long j = i+1; j <=r; j++) {
                min = Math.min(min,(i*j)%2019);
            }
        }
        out.println(min);*/
        out.flush();
    }
    static double distance(int [] a, int [] b) {
        double d = 0;
        for (int i = 0; i < a.length; i++) {
            int temp = (a[i]-b[i])*(a[i]-b[i]);
            d+=temp;
        }
        return Math.sqrt(d);
    }
    static boolean isInteger(double d) {
        return d == (int)d;
    }
    static int f(LinkedList<Integer> q) {
        int size = q.size();
        int count = 0;
        size/=2;
        while (size-->0) {
            int first = q.pollFirst();
            int second = q.pollFirst();
            if(first+second>=10) count++;
            int newValue = (first+second)%10;
            q.addLast(newValue);
        }
        return count;
    }
}

class InputReader extends BufferedReader {
    StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    }

    public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.valueOf(next());
    }
    public Long nextLong() {return  Long.valueOf(next());}

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    }
}