Prime Protocol

View as PDF

Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

In the kingdom of MAPS, the royal archives contain a sequence of scrolls numbered from X to Y. The Prime Minister (literally a minister obsessed with prime numbers) has devised a new Prime Security Protocol to ensure the archives remain safe from spies.

The protocol states that for every window of exactly M consecutive scrolls, there must be at least K prime-numbered scrolls to ensure numerical purity. If a spy tries to extract knowledge from the archives, they will always encounter a sufficient number of prime scrolls in any section, dismantling their evil plans.

As the kingdom's Chief Mathematician, you must determine the smallest possible M that satisfies this protocol. If there exists no valid M, report -1 to the Prime Minister.

Input

A single line containing three integers X, Y, K.

Output

A single line containing one integer M (if it exists) or -1.

Constraints

  • 1 \leq X, Y, K, \leq 10^6
  • X \leq Y

Example 1

Input
2 4 2
Output
3

Example 2

Input
2 4 3
Output
-1

Example 3

Input
6 13 1
Output
4

Comments

There are no comments at the moment.