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