import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int l = Integer.parseInt(sc.next());
        int r = Integer.parseInt(sc.next());
        
        long min = 2019;
        long rem;
        for(long i = l; i <= r-1; i++){
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    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) {
        
        Scanner sc = new Scanner(System.in);
        
        int l = Integer.parseInt(sc.next());
        int r = Integer.parseInt(sc.next());
        
        long min = 2019;
        long rem;
        for(long i = l; i <= r-1; i++){
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            }
            if(min == 0){
                break;
            }
        }
        
        System.out.println(min);
    }
} Main public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int l = Integer.parseInt(sc.next());
        int r = Integer.parseInt(sc.next());
        
        long min = 2019;
        long rem;
        for(long i = l; i <= r-1; i++){
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            }
            if(min == 0){
                break;
            }
        }
        
        System.out.println(min);
    } main {
        
        Scanner sc = new Scanner(System.in);
        
        int l = Integer.parseInt(sc.next());
        int r = Integer.parseInt(sc.next());
        
        long min = 2019;
        long rem;
        for(long i = l; i <= r-1; i++){
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            }
            if(min == 0){
                break;
            }
        }
        
        System.out.println(min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l = Integer.parseInt(sc.next()); l Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int r = Integer.parseInt(sc.next()); r Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long min = 2019; min 2019 long rem; rem for(long i = l; i <= r-1; i++){
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            }
            if(min == 0){
                break;
            }
        } long i = l; long i = l; i l i <= r-1 i r-1 r 1 i++ i++ i {
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            }
            if(min == 0){
                break;
            }
        } {
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            }
            if(min == 0){
                break;
            }
        } for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            } long j = i+1; long j = i+1; j i+1 i 1 j <= r j r j++ j++ j {
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            } {
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            } rem = (i*j) % 2019 rem (i*j) % 2019 (i*j) i j 2019 if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                } rem < min rem min {
                    min = rem;
                    if(min == 0){
                        break;
                    }
                } min = rem min rem 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) {
        
        Scanner sc = new Scanner(System.in);
        
        int l = Integer.parseInt(sc.next());
        int r = Integer.parseInt(sc.next());
        
        long min = 2019;
        long rem;
        for(long i = l; i <= r-1; i++){
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            }
            if(min == 0){
                break;
            }
        }
        
        System.out.println(min);
    }
} public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int l = Integer.parseInt(sc.next());
        int r = Integer.parseInt(sc.next());
        
        long min = 2019;
        long rem;
        for(long i = l; i <= r-1; i++){
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    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) {
        
        Scanner sc = new Scanner(System.in);
        
        int l = Integer.parseInt(sc.next());
        int r = Integer.parseInt(sc.next());
        
        long min = 2019;
        long rem;
        for(long i = l; i <= r-1; i++){
            for(long j = i+1; j <= r; j++){
                rem = (i*j) % 2019;
                if(rem < min){
                    min = rem;
                    if(min == 0){
                        break;
                    }
                }
            }
            if(min == 0){
                break;
            }
        }
        
        System.out.println(min);
    }
}