|
Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Автор: Павел Кузнецов, ПГУ.
For any positive integer N its factorial is defined in the following way:
N! = 1 · 2 · ... · N
Your task is to find K successive digits in a row in number N!,
beginning from the first nonzero digit. See the examples for details.
Input
The first line of the input contains integers N and K (1 ≤ N ≤ 50000; 1 ≤ K ≤ 10).
Output
The output represents the answer to the question. The answer should have
no spaces or other symbols except digits.
Input 1
|
Output 1
|
10 3
|
288
|
Comment: 10! = 3628800. The first nonzero digit is 8.
The three successive digits beginning with 8 are 288.
|
Input 2
|
Output 2
|
13 4
|
0208
|
Comment: 13! = 6227020800. The first nonzero digit is 8. The four
successive digits beginning with 8 are 0208. The leading 0 is obligatory!
|
Input 3
|
Output 3
|
5 10
|
12
|
Comment: 5! = 120. The first nonzero digit is 2. There are only two
successive digits beginning with 2, which is less than 10, so it is
necessary to write all of them without the leading zeros!
|
Для отправки решений необходимо выполнить вход.
|