import java.util.*;

import static java.lang.Math.round;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int modl =   l% 2019;
        int modr = r%2019;
        long ans =2018;

        if(modr<= r-l){
            System.out.println(0);
        }else{
            for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            }
            System.out.println(ans);

        }






        }
    } import java.util.*; util.* java import static java.lang.Math.round; import static java.lang.Math.round; import static java.lang.Math.round; public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int modl =   l% 2019;
        int modr = r%2019;
        long ans =2018;

        if(modr<= r-l){
            System.out.println(0);
        }else{
            for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            }
            System.out.println(ans);

        }






        }
    } Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int modl =   l% 2019;
        int modr = r%2019;
        long ans =2018;

        if(modr<= r-l){
            System.out.println(0);
        }else{
            for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            }
            System.out.println(ans);

        }






        } main {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int modl =   l% 2019;
        int modr = r%2019;
        long ans =2018;

        if(modr<= r-l){
            System.out.println(0);
        }else{
            for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            }
            System.out.println(ans);

        }






        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l = sc.nextInt(); l sc.nextInt() sc.nextInt sc int r = sc.nextInt(); r sc.nextInt() sc.nextInt sc int modl =   l% 2019; modl l% 2019 l 2019 int modr = r%2019; modr r%2019 r 2019 long ans =2018; ans 2018 if(modr<= r-l){
            System.out.println(0);
        }else{
            for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            }
            System.out.println(ans);

        } modr<= r-l modr r-l r l {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 {
            for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            }
            System.out.println(ans);

        } for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            } int p=modl; int p=modl; p modl p < modr p modr p++ p++ p {
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            } {
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            } for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                } int q=p+1; int q=p+1; q p+1 p 1 q <= modr q modr q++ q++ q {
                    ans = Math.min(ans, (p*q)%2019);

                } {
                    ans = Math.min(ans, (p*q)%2019);

                } ans = Math.min(ans, (p*q)%2019) ans Math.min(ans, (p*q)%2019) Math.min Math ans (p*q)%2019 (p*q) p q 2019 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int modl =   l% 2019;
        int modr = r%2019;
        long ans =2018;

        if(modr<= r-l){
            System.out.println(0);
        }else{
            for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            }
            System.out.println(ans);

        }






        }
    } public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int modl =   l% 2019;
        int modr = r%2019;
        long ans =2018;

        if(modr<= r-l){
            System.out.println(0);
        }else{
            for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            }
            System.out.println(ans);

        }






        }
    } Main
import java.util.*;

import static java.lang.Math.round;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int modl =   l% 2019;
        int modr = r%2019;
        long ans =2018;

        if(modr<= r-l){
            System.out.println(0);
        }else{
            for(int p=modl; p < modr; p++){
                for(int q=p+1; q <= modr; q++){
                    ans = Math.min(ans, (p*q)%2019);

                }
            }
            System.out.println(ans);

        }






        }
    }