
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int L = stdIn.nextInt(); int R = stdIn.nextInt();
        int answer = 2018;
        if( R - L + 1 >= 673) answer = 0;
        else{
            for(int i = L; i <= R -1; i++){
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            }
        }
        System.out.println(answer);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int L = stdIn.nextInt(); int R = stdIn.nextInt();
        int answer = 2018;
        if( R - L + 1 >= 673) answer = 0;
        else{
            for(int i = L; i <= R -1; i++){
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            }
        }
        System.out.println(answer);
    }
} Main public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int L = stdIn.nextInt(); int R = stdIn.nextInt();
        int answer = 2018;
        if( R - L + 1 >= 673) answer = 0;
        else{
            for(int i = L; i <= R -1; i++){
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            }
        }
        System.out.println(answer);
    } main {
        Scanner stdIn = new Scanner(System.in);
        int L = stdIn.nextInt(); int R = stdIn.nextInt();
        int answer = 2018;
        if( R - L + 1 >= 673) answer = 0;
        else{
            for(int i = L; i <= R -1; i++){
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            }
        }
        System.out.println(answer);
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int L = stdIn.nextInt(); L stdIn.nextInt() stdIn.nextInt stdIn int R = stdIn.nextInt(); R stdIn.nextInt() stdIn.nextInt stdIn int answer = 2018; answer 2018 if( R - L + 1 >= 673) answer = 0;
        else{
            for(int i = L; i <= R -1; i++){
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            }
        } R - L + 1 >= 673 R - L + 1 R - L R L 1 673 answer = 0 answer 0 {
            for(int i = L; i <= R -1; i++){
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            }
        } for(int i = L; i <= R -1; i++){
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            } int i = L; int i = L; i L i <= R -1 i R -1 R 1 i++ i++ i {
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            } {
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            } for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= R j R j++ j++ j {
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                } {
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                } if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    } answer > (i % 2019) * (j % 2019) % 2019 answer (i % 2019) * (j % 2019) % 2019 (i % 2019) * (j % 2019) (i % 2019) i 2019 (j % 2019) j 2019 2019 {
                        answer = (i % 2019) * (j % 2019) % 2019;
                    } answer = (i % 2019) * (j % 2019) % 2019 answer (i % 2019) * (j % 2019) % 2019 (i % 2019) * (j % 2019) (i % 2019) i 2019 (j % 2019) j 2019 2019 System.out.println(answer) System.out.println System.out System System.out answer String[] args args

import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int L = stdIn.nextInt(); int R = stdIn.nextInt();
        int answer = 2018;
        if( R - L + 1 >= 673) answer = 0;
        else{
            for(int i = L; i <= R -1; i++){
                for(int j = i + 1; j <= R; j++){
                    if(answer > (i % 2019) * (j % 2019) % 2019){
                        answer = (i % 2019) * (j % 2019) % 2019;
                    }
                }
            }
        }
        System.out.println(answer);
    }
}