import math MAX_PRIME = 100000+10 isPrime = [1 for i in range(MAX_PRIME)] primes = [] isPrime[0] = 0 isPrime[1] = 0 for i in range(2, MAX_PRIME) : if isPrime[i] == 1: for j in range(i + i, MAX_PRIME, i) : isPrime[j] = 0 primes.append(i) L, H = list(map(int, input().split())) minPrimes = -1 ans = -1 SZ = len(primes) for i in range(SZ) : for j in range(i+1) : k = primes[i] * primes[j] if L <= k <= H : tmp = primes[j] if minPrimes < tmp : minPrimes = tmp ans = k elif minPrimes == tmp : ans = max(ans, k) elif k > H : break print(ans)