#MTHA0000004. Đếm số không chia hết (Count Non-Multiples)

Đếm số không chia hết (Count Non-Multiples)

Count Non-Multiples

Version: Phuoc Hung OJ Extended

Problem Statement

Given positive integers L,R,KL,R,K with L≤RL\le R, count the integers in [L,R][L,R] that are not divisible by KK.

Input

One line contains three positive integers LL, RR, and KK.

Output

Print the number of integers XX satisfying L≤X≤RL\le X\le R and XX is not divisible by KK.

Subtasks

  • Subtask 1 (30 points):
    • 1≤L≤R≤10181 \le L \le R \le 10^{18}.
    • R−L≤106R-L \le 10^6.
    • 1≤K≤10181 \le K \le 10^{18}.
  • Subtask 2 (70 points):
    • 1≤L≤R≤10181 \le L \le R \le 10^{18}.
    • 1≤K≤10181 \le K \le 10^{18}.

Examples

Example 1

Input

1 10 3

Output

7

Explanation

There are 1010 integers. Exactly ⌊10/3⌋=3\lfloor10/3\rfloor=3 are divisible by 33, leaving 10−3=710-3=7.

Example 2

Input

8 8 4

Output

0

Explanation

The interval contains only 88, which is divisible by 44, so the answer is 00.

Example 3

Input

100 110 50

Output

10

Explanation

The interval has 1111 integers and only 100100 is divisible by 5050, so 1010 are not divisible.