#P31. [KBC001F] Class

[KBC001F] Class

Source

This problem is adapted from Long Long OJ. All rights reserved.

Description

Alice went to the seventh grade today! The first class Alice had is a Maths class. During the class, the teacher gave him a difficult problem:

Given a sequence aa, it is known that:

$$a=\{\text{Round}(\sqrt{2},N),\text{Round}(\sqrt{3},N),\text{Round}(\sqrt{4},N),\cdots,\text{Round}(\sqrt{K},N)\} $$

Here, Round(x,y)\text{Round}(x,y) represents rounding xx to yy decimal places.

Given N,K,XN,K,X, find:

  1. The sum of the number of occurrences of the decimal part XX in each element of this sequence.
  2. The sum of the digits of the decimal part in each element of this sequence.

Input

One line consisting of three integers N,K,XN,K,X.

Output

The output consists of two lines:

  • The first line is the sum of the number of occurrences of the decimal part XX in each element of the sequence.
  • The second line is the sum of the digits of the decimal part in each element of the sequence.

Samples

2 5 4
2
21

Tips

Sample Explanation:

$\sqrt2\approx1.41,\sqrt3\approx1.73,\sqrt4=2,\sqrt5\approx2.24$.

4+1+7+3+2+4=214+1+7+3+2+4=21.


  • 1N2001 \leq N \leq 200.
  • 1K10001 \leq K \leq 1000.
  • 1X91 \leq X \leq 9.