
import java.util.Scanner;

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

        int min = 2018;
        int mod;

        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                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) throws Exception {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextInt();
        long R = sc.nextInt();

        int min = 2018;
        int mod;

        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            }
            if(min == 0) {
                break;
            }
        }

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

        int min = 2018;
        int mod;

        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            }
            if(min == 0) {
                break;
            }
        }

        System.out.println(min);
    } main {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextInt();
        long R = sc.nextInt();

        int min = 2018;
        int mod;

        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            }
            if(min == 0) {
                break;
            }
        }

        System.out.println(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = sc.nextInt(); L sc.nextInt() sc.nextInt sc long R = sc.nextInt(); R sc.nextInt() sc.nextInt sc int min = 2018; min 2018 int mod; mod for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            }
            if(min == 0) {
                break;
            }
        } long i = L; long i = L; i L i < R i R i++ i++ i {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            }
            if(min == 0) {
                break;
            }
        } {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            }
            if(min == 0) {
                break;
            }
        } for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            } {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            } if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                } min >= (mod = (int) (i * j % 2019)) min (mod = (int) (i * j % 2019)) mod (int) (i * j % 2019) i * j i j 2019 {
                    min = mod;
                } min = mod min mod if (min == 0) {
                    break;
                } min == 0 min 0 {
                    break;
                } break; if(min == 0) {
                break;
            } min == 0 min 0 {
                break;
            } break; 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 L = sc.nextInt();
        long R = sc.nextInt();

        int min = 2018;
        int mod;

        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            }
            if(min == 0) {
                break;
            }
        }

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

        int min = 2018;
        int mod;

        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                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) throws Exception {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextInt();
        long R = sc.nextInt();

        int min = 2018;
        int mod;

        for (long i = L; i < R; i++) {
            for (long j = i + 1; j <= R; j++) {
                if (min >= (mod = (int) (i * j % 2019))) {
                    min = mod;
                }
                if (min == 0) {
                    break;
                }
            }
            if(min == 0) {
                break;
            }
        }

        System.out.println(min);
    }
}