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

#GL0000208. Tổng số ước và tổng các ước trên các bội (Divisors)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tổng số ước và tổng các ước trên các bội (Divisors)

Tổng số ước và tổng các ước trên các bội (Divisors)

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Let d(x)d(x) be the number of positive divisors of xx and σ(x)\sigma(x) their sum. Given a,b,ka,b,k, consider all integers ii with a≤i≤ba\le i\le b and k∣ik\mid i. Compute G=∑d(i)G=\sum d(i) and H=∑σ(i)H=\sum\sigma(i) over these integers; an empty sum is zero.

Input

One line containing a,b,ka,b,k.

Output

Print GG and HH separated by one space.

Subtasks

  • Subtask 1 (20 points): 1≤a≤b≤1001\le a\le b\le 100; 1≤k≤201\le k\le 20.

  • Subtask 2 (30 points): 1≤a≤b≤100001\le a\le b\le 10000; 1≤k≤2001\le k\le 200.

  • Subtask 3 (50 points): 1≤a≤b≤1000001\le a\le b\le 100000; 1≤k≤19991\le k\le 1999.

Examples

Example 1

Input

5 12 3

Output

13 53

Explanation

The multiples 6, 9, 12 have divisor counts 4, 3, 6 and divisor sums 12, 13, 28 respectively.

Example 2

Input

1 100 3

Output

217 3323

Explanation

Sum the divisor statistics over 3,6,...,99.

Example 3

Input

1 1 1

Output

1 1

Explanation

The only integer in the range is 1, whose divisor count and sum are both 1.