import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        
        if (r - l >= 2018) {
            System.out.println(0);
            return;
        }
        
        int min = 2000000000;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        }
        System.out.println(min);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        
        if (r - l >= 2018) {
            System.out.println(0);
            return;
        }
        
        int min = 2000000000;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        }
        System.out.println(min);
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        
        if (r - l >= 2018) {
            System.out.println(0);
            return;
        }
        
        int min = 2000000000;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        }
        System.out.println(min);
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        
        if (r - l >= 2018) {
            System.out.println(0);
            return;
        }
        
        int min = 2000000000;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        }
        System.out.println(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l = sc.nextInt(); l sc.nextInt() sc.nextInt sc int r = sc.nextInt(); r sc.nextInt() sc.nextInt sc if (r - l >= 2018) {
            System.out.println(0);
            return;
        } r - l >= 2018 r - l r l 2018 {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; int min = 2000000000; min 2000000000 for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        } int i = l; int i = l; i l i < r i r i++ i++ i {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        } {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        } for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            } int j = l + 1; int j = l + 1; j l + 1 l 1 j <= r j r j++ j++ j {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            } {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            } long tmp = ((long)i * j) % 2019; tmp ((long)i * j) % 2019 ((long)i * j) (long)i j 2019 int tmp2 = (int)tmp; tmp2 (int)tmp tmp = 1 tmp 1 min = Math.min(min, (int)tmp*tmp2) min Math.min(min, (int)tmp*tmp2) Math.min Math min (int)tmp*tmp2 (int)tmp tmp2 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) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        
        if (r - l >= 2018) {
            System.out.println(0);
            return;
        }
        
        int min = 2000000000;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        }
        System.out.println(min);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        
        if (r - l >= 2018) {
            System.out.println(0);
            return;
        }
        
        int min = 2000000000;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        }
        System.out.println(min);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        
        if (r - l >= 2018) {
            System.out.println(0);
            return;
        }
        
        int min = 2000000000;
        for (int i = l; i < r; i++) {
            for (int j = l + 1; j <= r; j++) {
                long tmp = ((long)i * j) % 2019;
                int tmp2 = (int)tmp;
                tmp = 1;
                min = Math.min(min, (int)tmp*tmp2);
            }
        }
        System.out.println(min);
    }
}