Problems
Minimal d-rate
Minimal d-rate
Let \textbf{p} - a prime number. Take an integer \textbf{i} ≥ \textbf{0} and raise all the integers from \textbf{0} to \textbf{p-1} degree \textbf{2^i} modulo \textbf{p}. Denote the resulting set of numbers through \textbf{S_i}, and the number of elements in this set - via \textbf{d_i}. Called \textbf{d}-exponent of \textbf{p} smallest of the numbers \textbf{d_i}, for all possible \textbf{i} ≥ \textbf{0}.
You are given two positive integers \textbf{A} and \textbf{B}. Among all the primes in the interval \[\textbf{A}, \textbf{B}\] is necessary to find such a figure whose \textbf{d}-minimal. It is guaranteed that in the interval \[\textbf{A}, \textbf{B}\] has at least one prime number.
\InputFile
Two positive integers \textbf{A} and \textbf{B} (\textbf{2} ≤ \textbf{A} ≤ \textbf{B} ≤ \textbf{10^6}).
\OutputFile
The only integer - the minimum \textbf{d}-value for primes in the interval \[\textbf{A}, \textbf{B}\].
Input example #1
7 15
Output example #1
4