import java.util.*;

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

        long ans = 999999999;
        long Flag = (long) R/2019;
        Flag *= 2019;

        if(Flag == 0){
            ans = (L * (L + 1))%2019;
        }else if(L <= Flag){
            ans = 0;
        }else if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        }

        System.out.println(ans);

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        long ans = 999999999;
        long Flag = (long) R/2019;
        Flag *= 2019;

        if(Flag == 0){
            ans = (L * (L + 1))%2019;
        }else if(L <= Flag){
            ans = 0;
        }else if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        }

        System.out.println(ans);

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        long ans = 999999999;
        long Flag = (long) R/2019;
        Flag *= 2019;

        if(Flag == 0){
            ans = (L * (L + 1))%2019;
        }else if(L <= Flag){
            ans = 0;
        }else if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        }

        System.out.println(ans);

    } main {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        long ans = 999999999;
        long Flag = (long) R/2019;
        Flag *= 2019;

        if(Flag == 0){
            ans = (L * (L + 1))%2019;
        }else if(L <= Flag){
            ans = 0;
        }else if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        }

        System.out.println(ans);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = sc.nextLong(); L sc.nextLong() sc.nextLong sc long R = sc.nextLong(); R sc.nextLong() sc.nextLong sc long ans = 999999999; ans 999999999 long Flag = (long) R/2019; Flag (long) R/2019 (long) R 2019 Flag *= 2019 Flag 2019 if(Flag == 0){
            ans = (L * (L + 1))%2019;
        }else if(L <= Flag){
            ans = 0;
        }else if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        } Flag == 0 Flag 0 {
            ans = (L * (L + 1))%2019;
        } ans = (L * (L + 1))%2019 ans (L * (L + 1))%2019 (L * (L + 1)) L (L + 1) L 1 2019 if(L <= Flag){
            ans = 0;
        }else if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        } L <= Flag L Flag {
            ans = 0;
        } ans = 0 ans 0 if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        } Flag < L Flag L {
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        } for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            } long i = L; long i = L; i L i < R i R i++ i++ i {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            } {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            } for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                } long j = (L+1); long j = (L+1); j (L+1) L 1 j <= R j R j++ j++ j {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                } {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                } long tmp = (i*j)%2019; tmp (i*j)%2019 (i*j) i j 2019 if(tmp < ans) ans = tmp; tmp < ans tmp ans ans = tmp ans tmp System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        long ans = 999999999;
        long Flag = (long) R/2019;
        Flag *= 2019;

        if(Flag == 0){
            ans = (L * (L + 1))%2019;
        }else if(L <= Flag){
            ans = 0;
        }else if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        }

        System.out.println(ans);

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

        long ans = 999999999;
        long Flag = (long) R/2019;
        Flag *= 2019;

        if(Flag == 0){
            ans = (L * (L + 1))%2019;
        }else if(L <= Flag){
            ans = 0;
        }else if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        }

        System.out.println(ans);

    }
} Main
import java.util.*;

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

        long ans = 999999999;
        long Flag = (long) R/2019;
        Flag *= 2019;

        if(Flag == 0){
            ans = (L * (L + 1))%2019;
        }else if(L <= Flag){
            ans = 0;
        }else if(Flag < L){
            for (long i = L; i < R; i++) {
                for (long j = (L+1); j <= R; j++) {
                    long tmp = (i*j)%2019;
                    if(tmp < ans) ans = tmp;
                }
            }
        }

        System.out.println(ans);

    }
}
