import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long low = sc.nextLong(); long high = sc.nextLong(); long p = (long)Math.sqrt(high); boolean[] isNotPrime = new boolean[(int)p + 1]; ArrayList primes = new ArrayList<>(); for (int i = 2; i < isNotPrime.length; i++) { if (!isNotPrime[i]) { primes.add(i); for (int j = 2; j * i < isNotPrime.length; j++) { isNotPrime[j * i] = true; } } } for (int i = primes.size() - 1; i >= 0; i--) { int ans = primes.get(i); long out = 0; for (long j = (low + ans - 1) / ans; j * ans <= high; j++) { boolean notDivide = true; for (int k = 0; k < i && notDivide; k++) { notDivide = (j % primes.get(k) != 0); } if (notDivide) { out = Math.max(out, ans * j); } } if (out > 0) { System.out.println(out); return; } } } }