
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();
        if (R - L >= 2018L) {
            System.out.println(0);
            return;
        }
        long m1 = L  % 2019L;
        long m2 = R % 2019L;
        if (m1 > m2) {
            System.out.println(0);
            return;
        }
        long ans = 2019;

        for (long i = m1; i < m2; ++i) {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();
        if (R - L >= 2018L) {
            System.out.println(0);
            return;
        }
        long m1 = L  % 2019L;
        long m2 = R % 2019L;
        if (m1 > m2) {
            System.out.println(0);
            return;
        }
        long ans = 2019;

        for (long i = m1; i < m2; ++i) {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();
        if (R - L >= 2018L) {
            System.out.println(0);
            return;
        }
        long m1 = L  % 2019L;
        long m2 = R % 2019L;
        if (m1 > m2) {
            System.out.println(0);
            return;
        }
        long ans = 2019;

        for (long i = m1; i < m2; ++i) {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        }
        System.out.println(ans);
    } main {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();
        if (R - L >= 2018L) {
            System.out.println(0);
            return;
        }
        long m1 = L  % 2019L;
        long m2 = R % 2019L;
        if (m1 > m2) {
            System.out.println(0);
            return;
        }
        long ans = 2019;

        for (long i = m1; i < m2; ++i) {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        }
        System.out.println(ans);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) long L = scanner.nextLong(); L scanner.nextLong() scanner.nextLong scanner long R = scanner.nextLong(); R scanner.nextLong() scanner.nextLong scanner if (R - L >= 2018L) {
            System.out.println(0);
            return;
        } R - L >= 2018L R - L R L 2018L {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; long m1 = L  % 2019L; m1 L  % 2019L L 2019L long m2 = R % 2019L; m2 R % 2019L R 2019L if (m1 > m2) {
            System.out.println(0);
            return;
        } m1 > m2 m1 m2 {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; long ans = 2019; ans 2019 for (long i = m1; i < m2; ++i) {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        } long i = m1; long i = m1; i m1 i < m2 i m2 ++i ++i i {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        } {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        } for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= m2 j m2 ++j ++j j {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            } {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            } long current = ((i % 2019L) * (j) % 2019L) % 2019L; current ((i % 2019L) * (j) % 2019L) % 2019L ((i % 2019L) * (j) % 2019L) (i % 2019L) * (j) (i % 2019L) i 2019L (j) 2019L 2019L ans = Math.min(ans, current) ans Math.min(ans, current) Math.min Math ans current 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 scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();
        if (R - L >= 2018L) {
            System.out.println(0);
            return;
        }
        long m1 = L  % 2019L;
        long m2 = R % 2019L;
        if (m1 > m2) {
            System.out.println(0);
            return;
        }
        long ans = 2019;

        for (long i = m1; i < m2; ++i) {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();
        if (R - L >= 2018L) {
            System.out.println(0);
            return;
        }
        long m1 = L  % 2019L;
        long m2 = R % 2019L;
        if (m1 > m2) {
            System.out.println(0);
            return;
        }
        long ans = 2019;

        for (long i = m1; i < m2; ++i) {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        }
        System.out.println(ans);
    }
} Main

import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        long L = scanner.nextLong();
        long R = scanner.nextLong();
        if (R - L >= 2018L) {
            System.out.println(0);
            return;
        }
        long m1 = L  % 2019L;
        long m2 = R % 2019L;
        if (m1 > m2) {
            System.out.println(0);
            return;
        }
        long ans = 2019;

        for (long i = m1; i < m2; ++i) {
            for (long j = i + 1; j <= m2; ++j) {
                long current = ((i % 2019L) * (j) % 2019L) % 2019L;
                ans = Math.min(ans, current);
            }
        }
        System.out.println(ans);
    }
}
