import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        if(R - L >= 2019){
            System.out.println(0);
        }
        else {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        }

    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        if(R - L >= 2019){
            System.out.println(0);
        }
        else {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        }

    }

} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        if(R - L >= 2019){
            System.out.println(0);
        }
        else {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        }

    } main {
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        if(R - L >= 2019){
            System.out.println(0);
        }
        else {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        }

    } Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scanner new Scanner(new BufferedReader(new InputStreamReader(System.in))) long L = scanner.nextInt(); L scanner.nextInt() scanner.nextInt scanner long R = scanner.nextInt(); R scanner.nextInt() scanner.nextInt scanner if(R - L >= 2019){
            System.out.println(0);
        }
        else {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        } R - L >= 2019 R - L R L 2019 {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        } int min = 2019; min 2019 for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            } long i = L; long i = L; i L i <= R i R i++ i++ i {
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            } {
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            } for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                } {
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                } long t = (i * j)%2019; t (i * j)%2019 (i * j) i j 2019 min = (int) Math.min(min, t) min (int) Math.min(min, t) Math.min Math min t 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 scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        if(R - L >= 2019){
            System.out.println(0);
        }
        else {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        }

    }

} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        if(R - L >= 2019){
            System.out.println(0);
        }
        else {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        }

    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        if(R - L >= 2019){
            System.out.println(0);
        }
        else {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        }

    }

}
