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

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

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

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

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

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

        System.out.println(result);
    } main {
        Scanner scan = new Scanner(System.in);
        long L = scan.nextLong();
        long R = scan.nextLong();
        
        long result = 2018;

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

        System.out.println(result);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) long L = scan.nextLong(); L scan.nextLong() scan.nextLong scan long R = scan.nextLong(); R scan.nextLong() scan.nextLong scan long result = 2018; result 2018 for (long i = L; i < R; i++){
            for (long j = i + 1; j <= R; j++){
                long mod = (i * j) % 2019;
                if(result > mod) result = mod;
                if(result == 0) break;
            }
            if(result == 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++){
                long mod = (i * j) % 2019;
                if(result > mod) result = mod;
                if(result == 0) break;
            }
            if(result == 0) break;
        } {
            for (long j = i + 1; j <= R; j++){
                long mod = (i * j) % 2019;
                if(result > mod) result = mod;
                if(result == 0) break;
            }
            if(result == 0) break;
        } for (long j = i + 1; j <= R; j++){
                long mod = (i * j) % 2019;
                if(result > mod) result = mod;
                if(result == 0) break;
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                long mod = (i * j) % 2019;
                if(result > mod) result = mod;
                if(result == 0) break;
            } {
                long mod = (i * j) % 2019;
                if(result > mod) result = mod;
                if(result == 0) break;
            } long mod = (i * j) % 2019; mod (i * j) % 2019 (i * j) i j 2019 if(result > mod) result = mod; result > mod result mod result = mod result mod if(result == 0) break; result == 0 result 0 break; if(result == 0) break; result == 0 result 0 break; System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
 
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long L = scan.nextLong();
        long R = scan.nextLong();
        
        long result = 2018;

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

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

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

        System.out.println(result);
    }
} Main

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

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

        System.out.println(result);
    }
}