import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long min = 2018;
        
        if (r - l <= 3000) {
            for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            }
        } else {
            min = 0;
        }
        System.out.println(min);
    }
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long min = 2018;
        
        if (r - l <= 3000) {
            for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            }
        } else {
            min = 0;
        }
        System.out.println(min);
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long min = 2018;
        
        if (r - l <= 3000) {
            for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            }
        } else {
            min = 0;
        }
        System.out.println(min);
    } main {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long min = 2018;
        
        if (r - l <= 3000) {
            for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            }
        } else {
            min = 0;
        }
        System.out.println(min);
    } 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 min = 2018; min 2018 if (r - l <= 3000) {
            for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            }
        } else {
            min = 0;
        } r - l <= 3000 r - l r l 3000 {
            for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            }
        } for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            } long i = l; long i = l; i l i <= r - 1 i r - 1 r 1 i++ i++ i {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            } {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            } for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                } {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                } long mod = i * j % 2019; mod i * j % 2019 i * j i j 2019 if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    } mod < min mod min {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    } min = mod min mod {
            min = 0;
        } min = 0 min 0 System.out.println(min) System.out.println System.out System System.out min 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 min = 2018;
        
        if (r - l <= 3000) {
            for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            }
        } else {
            min = 0;
        }
        System.out.println(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 min = 2018;
        
        if (r - l <= 3000) {
            for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            }
        } else {
            min = 0;
        }
        System.out.println(min);
    }
} Main
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextInt();
        long r = sc.nextInt();
        long min = 2018;
        
        if (r - l <= 3000) {
            for (long i = l; i <= r - 1; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long mod = i * j % 2019;
                    if (mod < min) {
                        //System.out.println(i + ", " + j);
                        min = mod;
                    }
                }
            }
        } else {
            min = 0;
        }
        System.out.println(min);
    }
}