#include <bits/stdc++.h>
using namespace std;

int main() {
	long long L, H;
	cin >> L >> H;

	const int N = 3e5 + 100;
	vector<long long> primes;
	vector<char> is_prime(N, true);

	for (int i = 2; i < N; i++) {
		if (is_prime[i]) {
			primes.push_back(i);
			for (int j = i * 2; j < N; j += i) {
				is_prime[j] = false;
			}
		}
	}

	vector<vector<long long>> dp(40);
	dp[0].push_back(1);
	for (int i = primes.size() - 1; i >= 0; i--) {
		for (int j = 0; j < 39; j++) {
			for (long long x : dp[j]) {
				if (x * primes[i] <= H) {
					dp[j + 1].push_back(x * primes[i]);
				}
			}
		}
		long long ans = 0;
		for (int j = 2; j < 39; j++) {
			for (long long x : dp[j]) {
				if (L <= x && x <= H) ans = max(ans, x);
			}
		}
		if (ans != 0) {
			cout << ans << endl;
			return 0;
		}
	}
	cout << "fail" << endl;
}