#include <bits/stdc++.h>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define EPS (1e-14)
#define _PA(x,N) rep(i,N){cout<<x[i]<<" ";}cout<<endl;
#define _PA2(x,H,W) rep(i,(H)){rep(j,(W)){cout<<x[i][j]<<" ";}cout<<endl;}

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;


int prime[100005];

ll L, H;
ll ans;
vector<ll> p;

void sieve_of_eratosthenes(int *a, int n) {
	fill(a, a+n, 1);
	a[0] = a[1] = 0;
	for (int i = 2; i * i < n; i++) {
		if (a[i] == 0) continue;
		for (int j = i + i; j < n; j += i) {
			a[j] = 0;
		}
	}
}

ll min_factor(ll x) {
	for (int i = 0; i < p.size(); i++) {
		if (x % p[i] == 0) {
			return p[i];
		}
	}
	return 1; // ありえない
}


void solve() {
	rep(i, 100005) prime[i] = true;
	sieve_of_eratosthenes(prime, 100005);
	rep(i, 100001) {
		if (prime[i] == 0) continue;
		p.push_back(i);
	}

	for (ll i = 0; i < p.size(); i++) {
		ll x = p[i];
		ll s = L / x + (L % x != 0);
		ll t = H / x;
		ll tmp = -1;
		for (ll j = s; j <= t; j++) {
			ll z = min_factor(j);
			if (z < x) continue;
			tmp = max(tmp, x * j);
		}
		if (tmp != -1) ans = tmp;
	}
	cout << ans << endl;
}

int main() {
	cin >> L >> H;
	solve();
	return 0;
}