QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 32 MB Total points: 100

#11494. B-Smooth Numbers

Statistics

Let $B$ be a positive integer. A natural number $n$ is called $B$-smooth, if in its factorisation into primes there is no prime factor greater then $B$. We may say equivalently that a number n is called $B$-smooth, if it may be represented as a product of positive integers less then or equal to $B$.

Task

Write a program which:

  • reads from the standard input three positive integers $n$, $m$ and $B$,
  • determines the number of all $B$-smooth numbers in the interval $[n,n+m]$ (inclusive),
  • writes the result to the standard output.

Input

In the first line of the standard input there are three integers $n$, $m$ and $B$, separated by single spaces, $1 \le n \le 2\,000\,000\,000$, $1 \le m \le 100\,000\,000$, $1 \le B \le 1\,000\,000$.

Output

Your program should write one integer in the first line of the standard output. It should be the determined number of B-smooth numbers.

Example

Input

30 10 5

Output

4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.