import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        long ans = 0;
        long min = 2018;
        long i;
        long j;
        for (i = L; i < R; i++) {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        System.out.println(min);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        long ans = 0;
        long min = 2018;
        long i;
        long j;
        for (i = L; i < R; i++) {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        System.out.println(min);
    }
} Main public static void main(String[] args) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args private void run() {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        long ans = 0;
        long min = 2018;
        long i;
        long j;
        for (i = L; i < R; i++) {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        System.out.println(min);
    } run {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        long ans = 0;
        long min = 2018;
        long i;
        long j;
        for (i = L; i < R; i++) {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        System.out.println(min);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) long L = scanner.nextInt(); L scanner.nextInt() scanner.nextInt scanner long R = scanner.nextInt(); R scanner.nextInt() scanner.nextInt scanner long ans = 0; ans 0 long min = 2018; min 2018 long i; i long j; j for (i = L; i < R; i++) {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        } i = L; i = L i L i < R i R i++ i++ i {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        } {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        } for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            } j = i + 1; j = i + 1 j i + 1 i 1 j <= R j R j++ j++ j {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            } {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            } ans = (i * j) % 2019 ans (i * j) % 2019 (i * j) i j 2019 if (min > ans) min = ans; min > ans min ans min = ans min ans if(min == 0) break; min == 0 min 0 break; if(min == 0) break; min == 0 min 0 break; System.out.println(min) System.out.println System.out System System.out min public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        long ans = 0;
        long min = 2018;
        long i;
        long j;
        for (i = L; i < R; i++) {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        System.out.println(min);
    }
} public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        long ans = 0;
        long min = 2018;
        long i;
        long j;
        for (i = L; i < R; i++) {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        System.out.println(min);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        long ans = 0;
        long min = 2018;
        long i;
        long j;
        for (i = L; i < R; i++) {
            for (j = i + 1; j <= R; j++) {
                ans = (i * j) % 2019;
                if (min > ans) min = ans;
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        System.out.println(min);
    }
}