import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final long L = Long.parseLong(sc.next());
        final long R = Long.parseLong(sc.next());
        sc.close();

        int min = Integer.MAX_VALUE;

        for (long i=L; i<R; i++) {
            for (long j=i+1; j<=R; j++) {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            }
        }

        System.out.println(min);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final long L = Long.parseLong(sc.next());
        final long R = Long.parseLong(sc.next());
        sc.close();

        int min = Integer.MAX_VALUE;

        for (long i=L; i<R; i++) {
            for (long j=i+1; j<=R; j++) {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            }
        }

        System.out.println(min);
    }
} Main public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final long L = Long.parseLong(sc.next());
        final long R = Long.parseLong(sc.next());
        sc.close();

        int min = Integer.MAX_VALUE;

        for (long i=L; i<R; i++) {
            for (long j=i+1; j<=R; j++) {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            }
        }

        System.out.println(min);
    } main {
        final Scanner sc = new Scanner(System.in);
        final long L = Long.parseLong(sc.next());
        final long R = Long.parseLong(sc.next());
        sc.close();

        int min = Integer.MAX_VALUE;

        for (long i=L; i<R; i++) {
            for (long j=i+1; j<=R; j++) {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            }
        }

        System.out.println(min);
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final long L = Long.parseLong(sc.next()); L Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc final long R = Long.parseLong(sc.next()); R Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc sc.close() sc.close sc int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (long i=L; i<R; i++) {
            for (long j=i+1; j<=R; j++) {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            }
        } long i=L; long i=L; i L i<R i R i++ i++ i {
            for (long j=i+1; j<=R; j++) {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            }
        } {
            for (long j=i+1; j<=R; j++) {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            }
        } for (long j=i+1; j<=R; j++) {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            } 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 (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            } {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            } long mod = (i * j) % 2019; mod (i * j) % 2019 (i * j) i j 2019 if (min>mod)
                    min = (int)mod; min>mod min mod min = (int)mod min (int)mod if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                } i%2019==0 || j%2019==0 i%2019==0 i%2019 i 2019 0 j%2019==0 j%2019 j 2019 0 {
                    System.out.println(0);
                    return;
                } System.out.println(0) System.out.println System.out System System.out 0 return; System.out.println(min) System.out.println System.out System System.out min String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final long L = Long.parseLong(sc.next());
        final long R = Long.parseLong(sc.next());
        sc.close();

        int min = Integer.MAX_VALUE;

        for (long i=L; i<R; i++) {
            for (long j=i+1; j<=R; j++) {
                long mod = (i * j) % 2019;
                if (min>mod)
                    min = (int)mod;
                if (i%2019==0 || j%2019==0) {
                    System.out.println(0);
                    return;
                }
            }
        }

        System.out.println(min);
    }
}