import java.util.Scanner;
 
public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int l = stdIn.nextInt();
        int a = l % 2019;
        int r = stdIn.nextInt();
        int b = r % 2019;
        boolean flag = false;
        
        for(int i = l; i <= r; i++){
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        }
        
        if(a > b){
            int tmp = a;
            a = b;
            b = tmp;
        }
        
        int min = 2018;
        
        if(a == b || flag == true){
            min = 0;
        }else{
            for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            }
        }
        
        
        System.out.println(min);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int l = stdIn.nextInt();
        int a = l % 2019;
        int r = stdIn.nextInt();
        int b = r % 2019;
        boolean flag = false;
        
        for(int i = l; i <= r; i++){
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        }
        
        if(a > b){
            int tmp = a;
            a = b;
            b = tmp;
        }
        
        int min = 2018;
        
        if(a == b || flag == true){
            min = 0;
        }else{
            for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            }
        }
        
        
        System.out.println(min);
    }
} Main public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int l = stdIn.nextInt();
        int a = l % 2019;
        int r = stdIn.nextInt();
        int b = r % 2019;
        boolean flag = false;
        
        for(int i = l; i <= r; i++){
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        }
        
        if(a > b){
            int tmp = a;
            a = b;
            b = tmp;
        }
        
        int min = 2018;
        
        if(a == b || flag == true){
            min = 0;
        }else{
            for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            }
        }
        
        
        System.out.println(min);
    } main {
        Scanner stdIn = new Scanner(System.in);
        int l = stdIn.nextInt();
        int a = l % 2019;
        int r = stdIn.nextInt();
        int b = r % 2019;
        boolean flag = false;
        
        for(int i = l; i <= r; i++){
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        }
        
        if(a > b){
            int tmp = a;
            a = b;
            b = tmp;
        }
        
        int min = 2018;
        
        if(a == b || flag == true){
            min = 0;
        }else{
            for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            }
        }
        
        
        System.out.println(min);
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int l = stdIn.nextInt(); l stdIn.nextInt() stdIn.nextInt stdIn int a = l % 2019; a l % 2019 l 2019 int r = stdIn.nextInt(); r stdIn.nextInt() stdIn.nextInt stdIn int b = r % 2019; b r % 2019 r 2019 boolean flag = false; flag false for(int i = l; i <= r; i++){
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        } int i = l; int i = l; i l i <= r i r i++ i++ i {
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        } {
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        } if(i % 2019 == 0){
                flag = true;
                break;
            } i % 2019 == 0 i % 2019 i 2019 0 {
                flag = true;
                break;
            } flag = true flag true break; if(a > b){
            int tmp = a;
            a = b;
            b = tmp;
        } a > b a b {
            int tmp = a;
            a = b;
            b = tmp;
        } int tmp = a; tmp a a = b a b b = tmp b tmp int min = 2018; min 2018 if(a == b || flag == true){
            min = 0;
        }else{
            for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            }
        } a == b || flag == true a == b a b flag == true flag true {
            min = 0;
        } min = 0 min 0 {
            for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            }
        } for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            } int i = a; int i = a; i a i <= b - 1 i b - 1 b 1 i++ i++ i {
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            } {
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            } for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                } int j = a + 1; int j = a + 1; j a + 1 a 1 j <= b j b j++ j++ j {
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                } {
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                } if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    } (i * j) % 2019 < min (i * j) % 2019 (i * j) i j 2019 min {
                        min = (i * j) % 2019;
                    } min = (i * j) % 2019 min (i * j) % 2019 (i * j) i j 2019 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 stdIn = new Scanner(System.in);
        int l = stdIn.nextInt();
        int a = l % 2019;
        int r = stdIn.nextInt();
        int b = r % 2019;
        boolean flag = false;
        
        for(int i = l; i <= r; i++){
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        }
        
        if(a > b){
            int tmp = a;
            a = b;
            b = tmp;
        }
        
        int min = 2018;
        
        if(a == b || flag == true){
            min = 0;
        }else{
            for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            }
        }
        
        
        System.out.println(min);
    }
} public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int l = stdIn.nextInt();
        int a = l % 2019;
        int r = stdIn.nextInt();
        int b = r % 2019;
        boolean flag = false;
        
        for(int i = l; i <= r; i++){
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        }
        
        if(a > b){
            int tmp = a;
            a = b;
            b = tmp;
        }
        
        int min = 2018;
        
        if(a == b || flag == true){
            min = 0;
        }else{
            for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            }
        }
        
        
        System.out.println(min);
    }
} Main
import java.util.Scanner;
 
public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int l = stdIn.nextInt();
        int a = l % 2019;
        int r = stdIn.nextInt();
        int b = r % 2019;
        boolean flag = false;
        
        for(int i = l; i <= r; i++){
            if(i % 2019 == 0){
                flag = true;
                break;
            }
        }
        
        if(a > b){
            int tmp = a;
            a = b;
            b = tmp;
        }
        
        int min = 2018;
        
        if(a == b || flag == true){
            min = 0;
        }else{
            for(int i = a; i <= b - 1; i++){
                for(int j = a + 1; j <= b; j++){
                    if((i * j) % 2019 < min){
                        min = (i * j) % 2019;
                    }
                }
            }
        }
        
        
        System.out.println(min);
    }
}