PivotOJ

Champernowne Count

시간 제한: 1000ms메모리 제한: 1024MB출처: ICPC Rocky Mountain Regional 2022-2023BOJ 27569

문제

The nnth Champernowne word is obtained by writing down the first nn positive integers and concatenating them together. For example, the 10th Champernowne word is "12345678910".

Given two positive integers nn and kk, count how many of the first nn Champernowne words are divisible by kk.

입력

The single line of input contains two integers, nn (1n105)(1 \le n \le 10^5) and kk (1k109)(1 \le k \le 10^9).

출력

Output a single integer, which is a count of the first nn Champernowne words divisible by kk.

예제

예제 1

입력
4 2
출력
2

예제 2

입력
100 7
출력
14

예제 3

입력
314 159
출력
4

예제 4

입력
100000 999809848
출력
1
코드를 제출하려면 로그인하세요.