#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef complex P; typedef pair pii; #define REP(i,n) for(ll i=0;i>=1; } return r; } int main(){ scanf("%lld%lld",&L,&H); REP(i,100000)isp[i]=true; isp[0]=isp[1]=false; FOR(x,2,100000){ if(!isp[x])continue; ps.push_back(x); { int it = x+x; while(it<100000){ isp[it]=false; it+=x; } } } if(H-L<0){ // brute-force ll mx = L-1; ll mfct = 0; FOR(x,L,H+1){ REP(i,ps.size()){ ll p = ps[i]; if(x<=p)break; if(x%p==0){ if(p>=mfct){ mfct = p; mx = x; } break; } } } printf("%lld\n",mx); }else{ ll ans = 1; ll mxmn = 1; REP(i,ps.size()){ ll x = ps[ps.size()-1-i]; if(x=L && ub>=x){ ll mfct=x; if(ub<100000 && isp[ub]){ mfct = min(x,ub); }else{ REP(j,ps.size()){ if(ub%ps[j]==0){ mfct=min(mfct,ps[j]); break; } } } ll fct = min(mfct,x); if(fct>mxmn || (fct==mxmn&&ub*x>ans)){ ans = ub*x; mxmn = fct; if(fct==x)break; } --ub; } } printf("%lld\n",ans); // set dp; // dp.insert(1); // FOR(i,0,ps.size()){ // ll x = ps[ps.size()-1-i]; // ll ans = -1; // for(ll p : dp){ // if(p*x>H)break; // dp.insert(p*x); // if(p!=1 && L<=p*x){ // ans = max(ans,p*x); // } // } // if(ans!=-1){ // printf("%lld\n",ans); // return 0; // } // } } return 0; }