Problems
Bessie the cow is back in school! She has started doing her math homework in which she is tasked to round positive integers to powers of
To round a positive integer
If
Then, Bessie sets all the digits including and to the right of the
For instance, if Bessie wanted to round
However, if Bessie were to round
After looking at Bessie's homework, Elsie thinks she has invented a new type of rounding: chain rounding. To chain round to the nearest
Bessie thinks Elsie is wrong, but is too busy with math homework to confirm her suspicions. She tasks you to count how many integers
Input
You have to answer multiple test cases.
The first line of input contains a single integer
The first and only line of input in every test case contains a single integer
Output
Output
Subtask
| # | Score | Condition |
|---|---|---|
| #1 | 20 | |
| #2 | 30 | |
| #3 | 50 | |
Example
4
1
100
4567
3366
0
5
183
60
Consider the second test case in the sample.
In the third test case, two integers counted are