import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int l = Integer.parseInt(st.nextToken());
        int r = Integer.parseInt(st.nextToken());
        if(r-l >=2019){
            System.out.println("0\n");
            return;
        }
        int min=Integer.MAX_VALUE;

        for(int i=l+1; i<=r;i++){
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        }
        System.out.println(min);
        System.out.println("\n");
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int l = Integer.parseInt(st.nextToken());
        int r = Integer.parseInt(st.nextToken());
        if(r-l >=2019){
            System.out.println("0\n");
            return;
        }
        int min=Integer.MAX_VALUE;

        for(int i=l+1; i<=r;i++){
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        }
        System.out.println(min);
        System.out.println("\n");
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int l = Integer.parseInt(st.nextToken());
        int r = Integer.parseInt(st.nextToken());
        if(r-l >=2019){
            System.out.println("0\n");
            return;
        }
        int min=Integer.MAX_VALUE;

        for(int i=l+1; i<=r;i++){
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        }
        System.out.println(min);
        System.out.println("\n");
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int l = Integer.parseInt(st.nextToken());
        int r = Integer.parseInt(st.nextToken());
        if(r-l >=2019){
            System.out.println("0\n");
            return;
        }
        int min=Integer.MAX_VALUE;

        for(int i=l+1; i<=r;i++){
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        }
        System.out.println(min);
        System.out.println("\n");
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int l = Integer.parseInt(st.nextToken()); l Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int r = Integer.parseInt(st.nextToken()); r Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st if(r-l >=2019){
            System.out.println("0\n");
            return;
        } r-l >=2019 r-l r l 2019 {
            System.out.println("0\n");
            return;
        } System.out.println("0\n") System.out.println System.out System System.out "0\n" return; int min=Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=l+1; i<=r;i++){
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        } int i=l+1; int i=l+1; i l+1 l 1 i<=r i r i++ i++ i {
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        } {
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        } for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            } int j=l; int j=l; j l j<i j i j++ j++ j {
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            } {
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            } int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019); temp Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019) Math.floorMod Math Math.floorMod(i,2019)*Math.floorMod(j,2019) Math.floorMod(i,2019) Math.floorMod Math i 2019 Math.floorMod(j,2019) Math.floorMod Math j 2019 2019 if(temp<min){
                    min=temp;
                } temp<min temp min {
                    min=temp;
                } min=temp min temp System.out.println(min) System.out.println System.out System System.out min System.out.println("\n") System.out.println System.out System System.out "\n" String[] args args public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int l = Integer.parseInt(st.nextToken());
        int r = Integer.parseInt(st.nextToken());
        if(r-l >=2019){
            System.out.println("0\n");
            return;
        }
        int min=Integer.MAX_VALUE;

        for(int i=l+1; i<=r;i++){
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        }
        System.out.println(min);
        System.out.println("\n");
    }
} public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int l = Integer.parseInt(st.nextToken());
        int r = Integer.parseInt(st.nextToken());
        if(r-l >=2019){
            System.out.println("0\n");
            return;
        }
        int min=Integer.MAX_VALUE;

        for(int i=l+1; i<=r;i++){
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        }
        System.out.println(min);
        System.out.println("\n");
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int l = Integer.parseInt(st.nextToken());
        int r = Integer.parseInt(st.nextToken());
        if(r-l >=2019){
            System.out.println("0\n");
            return;
        }
        int min=Integer.MAX_VALUE;

        for(int i=l+1; i<=r;i++){
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        }
        System.out.println(min);
        System.out.println("\n");
    }
}
