PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000107. Đếm số có đúng n ước (n-divisors)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đếm số có đúng n ước (n-divisors)

n-divisors

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

For a positive integer xx, let d(x)d(x) be its number of positive divisors, including 11 and itself. For example, d(1)=1d(1)=1, d(4)=3d(4)=3, and d(8)=4d(8)=4. Given a,b,na,b,n, count the integers x∈[a,b]x\in[a,b] satisfying d(x)=nd(x)=n.

Input

One line contains three integers a,b,na,b,n, where nn is the required divisor count.

Output

Print one integer: the count of x∈[a,b]x\in[a,b] with exactly nn positive divisors.

Subtasks

  • Subtask 1 (20 points): 1≤a≤b≤100001\le a\le b\le 10000; 0≤b−a≤2000\le b-a\le 200; 1≤n≤101\le n\le 10.
  • Subtask 2 (30 points): 1≤a≤b≤100000001\le a\le b\le 10000000; 0≤b−a≤20000\le b-a\le 2000; 1≤n≤501\le n\le 50.
  • Subtask 3 (50 points): 1≤a≤b≤10000000001\le a\le b\le 1000000000; 0≤b−a≤100000\le b-a\le 10000; 1≤n≤1001\le n\le 100.

Examples

Input

1 7 2

Output

4

Explanation

In [1,7][1,7], exactly 2,3,5,72,3,5,7 have two positive divisors. The number 11 has one; 44 and 66 have three and four respectively. Thus the answer is 44.