Under construction

Still being built. Things may change

Champernowne Count

Interview

Time limit1sMemory limit1024 MB

Summary
Count how many of the first n Champernowne words, the concatenations of 1 through m, are divisible by k.
Level

Easy3 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

The nnth Champernowne word is formed by writing the first nn positive integers in order and concatenating them. 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.

Input

The single line of input contains two integers nn (1≤n≤105)(1 \le n \le 10^5) and kk (1≤k≤109)(1 \le k \le 10^9).

Output

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

Examples4

  1. Example 1

    Input
    4 2
    
    Expected output
    2
    
  2. Example 2

    Input
    100 7
    
    Expected output
    14
    
  3. Example 3

    Input
    314 159
    
    Expected output
    4
    
  4. Example 4

    Input
    100000 999809848
    
    Expected output
    1