import java.util.*;

public class Main {

    public static void main(String[] args) {
        //
        //Compute c1 = new Compute();//計算系
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        int answer = 0;
        //String answer="No";
        //StringBuilder answer=new StringBuilder();
        //List<Integer> list = new ArrayList<>();
        //int array[] = new int[];

        //入力
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        Set<Integer> set=new HashSet<>();

        for (int i=l;i<=r;++i)
        {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        }

        int a[]=new int[set.size()];
        int ind=0;
        for (int i:set)
        {
            a[ind]=i;
            ++ind;
        }

        for (int i=0;i<a.length;++i)
        {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        }
        answer=min;
        //出力
        //BigDecimal bd = new BigDecimal(answer);
        //System.out.println(bd.setScale(12,BigDecimal.ROUND_DOWN));
        //System.out.println(String.format("%.0f",answer));
        System.out.println(answer);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        //
        //Compute c1 = new Compute();//計算系
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        int answer = 0;
        //String answer="No";
        //StringBuilder answer=new StringBuilder();
        //List<Integer> list = new ArrayList<>();
        //int array[] = new int[];

        //入力
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        Set<Integer> set=new HashSet<>();

        for (int i=l;i<=r;++i)
        {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        }

        int a[]=new int[set.size()];
        int ind=0;
        for (int i:set)
        {
            a[ind]=i;
            ++ind;
        }

        for (int i=0;i<a.length;++i)
        {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        }
        answer=min;
        //出力
        //BigDecimal bd = new BigDecimal(answer);
        //System.out.println(bd.setScale(12,BigDecimal.ROUND_DOWN));
        //System.out.println(String.format("%.0f",answer));
        System.out.println(answer);
    }
} Main public static void main(String[] args) {
        //
        //Compute c1 = new Compute();//計算系
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        int answer = 0;
        //String answer="No";
        //StringBuilder answer=new StringBuilder();
        //List<Integer> list = new ArrayList<>();
        //int array[] = new int[];

        //入力
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        Set<Integer> set=new HashSet<>();

        for (int i=l;i<=r;++i)
        {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        }

        int a[]=new int[set.size()];
        int ind=0;
        for (int i:set)
        {
            a[ind]=i;
            ++ind;
        }

        for (int i=0;i<a.length;++i)
        {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        }
        answer=min;
        //出力
        //BigDecimal bd = new BigDecimal(answer);
        //System.out.println(bd.setScale(12,BigDecimal.ROUND_DOWN));
        //System.out.println(String.format("%.0f",answer));
        System.out.println(answer);
    } main {
        //
        //Compute c1 = new Compute();//計算系
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        int answer = 0;
        //String answer="No";
        //StringBuilder answer=new StringBuilder();
        //List<Integer> list = new ArrayList<>();
        //int array[] = new int[];

        //入力
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        Set<Integer> set=new HashSet<>();

        for (int i=l;i<=r;++i)
        {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        }

        int a[]=new int[set.size()];
        int ind=0;
        for (int i:set)
        {
            a[ind]=i;
            ++ind;
        }

        for (int i=0;i<a.length;++i)
        {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        }
        answer=min;
        //出力
        //BigDecimal bd = new BigDecimal(answer);
        //System.out.println(bd.setScale(12,BigDecimal.ROUND_DOWN));
        //System.out.println(String.format("%.0f",answer));
        System.out.println(answer);
    } int count = 0; count 0 boolean sw = false; sw false int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE double dMax = Double.MIN_VALUE; dMax Double.MIN_VALUE Double Double.MIN_VALUE double dMin = Double.MAX_VALUE; dMin Double.MAX_VALUE Double Double.MAX_VALUE int answer = 0; answer 0 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 Set<Integer> set=new HashSet<>(); set new HashSet<>() for (int i=l;i<=r;++i)
        {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        } int i=l; int i=l; i l i<=r i r ++i ++i i {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        } {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        } set.add(i%2019) set.add set i%2019 i 2019 if (set.size()==2019) {break;} set.size()==2019 set.size() set.size set 2019 {break;} break; int a[]=new int[set.size()]; a new int[set.size()] set.size() set.size set int ind=0; ind 0 for (int i:set)
        {
            a[ind]=i;
            ++ind;
        } int i set {
            a[ind]=i;
            ++ind;
        } {
            a[ind]=i;
            ++ind;
        } a[ind]=i a[ind] a ind i ++ind ind for (int i=0;i<a.length;++i)
        {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        } int i=0; int i=0; i 0 i<a.length i a.length a a.length ++i ++i i {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        } {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        } for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            } int j=i+1; int j=i+1; j i+1 i 1 j<a.length j a.length a a.length ++j ++j j {
                min=Math.min(min,(a[i]*a[j])%2019);
            } {
                min=Math.min(min,(a[i]*a[j])%2019);
            } min=Math.min(min,(a[i]*a[j])%2019) min Math.min(min,(a[i]*a[j])%2019) Math.min Math min (a[i]*a[j])%2019 (a[i]*a[j]) a[i] a i a[j] a j 2019 answer=min answer min System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {

    public static void main(String[] args) {
        //
        //Compute c1 = new Compute();//計算系
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        int answer = 0;
        //String answer="No";
        //StringBuilder answer=new StringBuilder();
        //List<Integer> list = new ArrayList<>();
        //int array[] = new int[];

        //入力
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        Set<Integer> set=new HashSet<>();

        for (int i=l;i<=r;++i)
        {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        }

        int a[]=new int[set.size()];
        int ind=0;
        for (int i:set)
        {
            a[ind]=i;
            ++ind;
        }

        for (int i=0;i<a.length;++i)
        {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        }
        answer=min;
        //出力
        //BigDecimal bd = new BigDecimal(answer);
        //System.out.println(bd.setScale(12,BigDecimal.ROUND_DOWN));
        //System.out.println(String.format("%.0f",answer));
        System.out.println(answer);
    }
} public class Main {

    public static void main(String[] args) {
        //
        //Compute c1 = new Compute();//計算系
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        int answer = 0;
        //String answer="No";
        //StringBuilder answer=new StringBuilder();
        //List<Integer> list = new ArrayList<>();
        //int array[] = new int[];

        //入力
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        Set<Integer> set=new HashSet<>();

        for (int i=l;i<=r;++i)
        {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        }

        int a[]=new int[set.size()];
        int ind=0;
        for (int i:set)
        {
            a[ind]=i;
            ++ind;
        }

        for (int i=0;i<a.length;++i)
        {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        }
        answer=min;
        //出力
        //BigDecimal bd = new BigDecimal(answer);
        //System.out.println(bd.setScale(12,BigDecimal.ROUND_DOWN));
        //System.out.println(String.format("%.0f",answer));
        System.out.println(answer);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        //
        //Compute c1 = new Compute();//計算系
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        int answer = 0;
        //String answer="No";
        //StringBuilder answer=new StringBuilder();
        //List<Integer> list = new ArrayList<>();
        //int array[] = new int[];

        //入力
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        Set<Integer> set=new HashSet<>();

        for (int i=l;i<=r;++i)
        {
            set.add(i%2019);
            if (set.size()==2019) {break;}
        }

        int a[]=new int[set.size()];
        int ind=0;
        for (int i:set)
        {
            a[ind]=i;
            ++ind;
        }

        for (int i=0;i<a.length;++i)
        {
            for (int j=i+1;j<a.length;++j)
            {
                min=Math.min(min,(a[i]*a[j])%2019);
            }
        }
        answer=min;
        //出力
        //BigDecimal bd = new BigDecimal(answer);
        //System.out.println(bd.setScale(12,BigDecimal.ROUND_DOWN));
        //System.out.println(String.format("%.0f",answer));
        System.out.println(answer);
    }
}