#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## Problem Description

This is a function call problem. Please include*pinalysis.h*in your source code. You may use

*template.cpp*in the attachments as a starting point for your code.

Peanut has been obsessed with memorising Pi recently. 3.14159... how cool is that? Never mind. However, not only does he want to memorise Pi, he wants to conduct a Pinalysis!

What is a Pinalysis? Basically, he wants to count the number of each digit in a certain segment of Pi. For example, in the first ten digits of pi, 1415926535, there are 2 ones, 1 two, 1 three, etc.

He wants you to code the following functions:

*int countDigit(int S, int E, int D)*, which should return the number of digit*D*there is between the*S*th and*E*th digit of pi.

In this problem, we recognise that you might not be able to memorise pi entirely. Thus, you can call the following functions:

*int getDigit(int P)*, which will return the*P*th digit of pi.

## Input

There is no input for this problem. Use grader.cpp to grade the sample testcases on your computer.

## Output

There is no output for this problem.

## Limits

For all subtasks: 1 ≤ *D* ≤ 9

Subtask 1 (10%): 1 ≤ *S, E* ≤ 100. *countDigit()* will at most be called 100 times.

Subtask 2 (20%): 1 ≤ *S, E* ≤ 1000. *countDigit()* will at most be called 1000 times.

Subtask 3 (30%): 1 ≤ *S, E* ≤ 10000. *countDigit()* will at most be called 10000 times.

Subtask 4 (40%): 1 ≤ *S, E* ≤ 100000. *countDigit()* will at most be called 100000 times.

## Sample Input 1

10 1 4 1 5 9 2 6 5 3 5 4 1 2 1 1 3 1 2 8 9 3 5 6

## Sample Output 1

1 2 1 0

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 10 | 10 | 1s | 32MB | Minimum |

2 | 20 | 10 | 1s | 32MB | Minimum |

3 | 30 | 10 | 1s | 32MB | Minimum |

4 | 40 | 10 | 1s | 32MB | Minimum |

5 | 0 | 1 | 1s | 32MB | Minimum |

### Judge Compile Command

g++-7 grader.cpp ans.cpp -o pinalysis -Wall -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512