import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        long min = 1000000;

        loop: for (long i=a; i<=b; i++) {
            for (long j=i+1; j<=b; j++) {
                long times = i * j;
                long mod = times % 2019;
                if (mod == 0) {
                    min = 0;
                    break loop;
                }

                if (min > times % 2019) {
                    min = times % 2019;
                }
            }
        }

        System.out.println(min);
    }
} import java.io.File; File java.io import java.io.FileInputStream; FileInputStream java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        long min = 1000000;

        loop: for (long i=a; i<=b; i++) {
            for (long j=i+1; j<=b; j++) {
                long times = i * j;
                long mod = times % 2019;
                if (mod == 0) {
                    min = 0;
                    break loop;
                }

                if (min > times % 2019) {
                    min = times % 2019;
                }
            }
        }

        System.out.println(min);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        long min = 1000000;

        loop: for (long i=a; i<=b; i++) {
            for (long j=i+1; j<=b; j++) {
                long times = i * j;
                long mod = times % 2019;
                if (mod == 0) {
                    min = 0;
                    break loop;
                }

                if (min > times % 2019) {
                    min = times % 2019;
                }
            }
        }

        System.out.println(min);
    } main {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        long min = 1000000;

        loop: for (long i=a; i<=b; i++) {
            for (long j=i+1; j<=b; j++) {
                long times = i * j;
                long mod = times % 2019;
                if (mod == 0) {
                    min = 0;
                    break loop;
                }

                if (min > times % 2019) {
                    min = times % 2019;
                }
            }
        }

        System.out.println(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long a = sc.nextLong(); a sc.nextLong() sc.nextLong sc long b = sc.nextLong(); b sc.nextLong() sc.nextLong sc long min = 1000000; min 1000000 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 {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        long min = 1000000;

        loop: for (long i=a; i<=b; i++) {
            for (long j=i+1; j<=b; j++) {
                long times = i * j;
                long mod = times % 2019;
                if (mod == 0) {
                    min = 0;
                    break loop;
                }

                if (min > times % 2019) {
                    min = times % 2019;
                }
            }
        }

        System.out.println(min);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        long min = 1000000;

        loop: for (long i=a; i<=b; i++) {
            for (long j=i+1; j<=b; j++) {
                long times = i * j;
                long mod = times % 2019;
                if (mod == 0) {
                    min = 0;
                    break loop;
                }

                if (min > times % 2019) {
                    min = times % 2019;
                }
            }
        }

        System.out.println(min);
    }
} Main
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        long min = 1000000;

        loop: for (long i=a; i<=b; i++) {
            for (long j=i+1; j<=b; j++) {
                long times = i * j;
                long mod = times % 2019;
                if (mod == 0) {
                    min = 0;
                    break loop;
                }

                if (min > times % 2019) {
                    min = times % 2019;
                }
            }
        }

        System.out.println(min);
    }
}
