Fake Prime

No attempts yetTime limit2sMemory limit512 MB

Problem

Jigui met a problem that is only solvable after deciding whether a number around ten billion is prime. He wrote code that divides by every integer from 2 to N\sqrt{N}, but it produced no result after an hour. A search turned up Fermat's little theorem.

For a prime pp and every natural number aa with gcd(a,p)=1\gcd(a, p) = 1, ap11(modp)a^{p-1} \equiv 1 \pmod p.

Jigui used it backwards and wrote code that reports nn as prime when 2n11(modn)2^{n-1} \equiv 1 \pmod n. That code classified 561 as prime. Jigui did not give up, widened the set of bases, and settled on the following test.

Given a natural number nn, if every integer aa with 2a5002 \le a \le 500 satisfies an11(modn)a^{n-1} \equiv 1 \pmod n, report nn as prime. If even one of them fails, report nn as composite.

Jigui checked every number up to one million by computer, submitted the answer with confidence, and was wrong again. When n>500n > 500 a prime is always reported as prime, so the only way this test errs is by reporting a composite number as prime. Call such an nn a counterexample.

Show Jigui a counterexample. Given an integer LL, find the smallest counterexample greater than LL and the smallest prime factor of that counterexample.

Input

The first line contains an integer LL. (500L1012500 \le L \le 10^{12})

Output

On the first line, print the smallest counterexample nn greater than LL and the smallest prime factor mm of nn, separated by a space. The answer nn is always at most 101510^{15}, and mm satisfies 1<m<n1 < m < n.