import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();
        long d = input.nextInt();

        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = n; i < d; i++) {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
        System.out.println(remain);
    }
} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();
        long d = input.nextInt();

        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = n; i < d; i++) {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
        System.out.println(remain);
    }
} Main public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();
        long d = input.nextInt();

        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = n; i < d; i++) {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
        System.out.println(remain);
    } main {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();
        long d = input.nextInt();

        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = n; i < d; i++) {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
        System.out.println(remain);
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) long n = input.nextInt(); n input.nextInt() input.nextInt input long d = input.nextInt(); d input.nextInt() input.nextInt input long remain = (long)(2 * Math.pow(10,9)) * 2; remain (long)(2 * Math.pow(10,9)) * 2 (long)(2 * Math.pow(10,9)) 2 Math.pow(10,9) Math.pow Math 10 9 2 for (long i = n; i < d; i++) {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        } long i = n; long i = n; i n i < d i d i++ i++ i {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        } {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        } for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= d j d j++ j++ j {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            } {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            } if((i*j)%2019 < remain)
                    remain = (i*j)%2019; (i*j)%2019 < remain (i*j)%2019 (i*j) i j 2019 remain remain = (i*j)%2019 remain (i*j)%2019 (i*j) i j 2019 if(remain == 0)
                    break; remain == 0 remain 0 break; if(remain == 0)
                break; remain == 0 remain 0 break; System.out.println(remain) System.out.println System.out System System.out remain String[] args args public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();
        long d = input.nextInt();

        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = n; i < d; i++) {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
        System.out.println(remain);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();
        long d = input.nextInt();

        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = n; i < d; i++) {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
        System.out.println(remain);
    }
} Main
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();
        long d = input.nextInt();

        long remain = (long)(2 * Math.pow(10,9)) * 2;
        for (long i = n; i < d; i++) {
            for (long j = i + 1; j <= d; j++) {
                if((i*j)%2019 < remain)
                    remain = (i*j)%2019;
                if(remain == 0)
                    break;
            }
            if(remain == 0)
                break;
        }
        System.out.println(remain);
    }
}
