50117. Divide a number

I'm a slow walker, but I never walk backwards.

Task Description

We have a number $N$ and an one-digit number $k$. We want to compute the quotient of dividing $N$ by $k$. Note that $N$ has at least one digit, and it may be very large in this task, so we suggest that you use the method of long division, shown in the following picture.

samplesample

Input Format

The input has only one test case. The first line is $k$. The following lines are $N$ with a single digit in each line, starting from the leading digit. For example, sample input 1 has $k$ equal to $5$, and $N$ equal to $23$.

Output Format

The output is the result of $N$ divided by $k$. Starting from the leading digit, print it digit-by-digit in lines. Do not print the remainder. Notice that the leading digit cannot be zero.

Subtask

  • 5 points: $k$ is $1$.
  • 10 points: $k$ is $2$, and all digits of $N$ are even numbers.
  • 85 points: you will get MLE if you use array to store $N$.

Sample Input 1

5
2
3

Sample Output 1

4

Sample Input 2

9
6

Sample Output 2

0

Sample Input 3

2
2
6
8
0

Sample Output 3

1
3
4
0

Sample Input 4

7
3
8
4
8

Sample Output 4

5
4
9

Discussion