Under construction

Still being built. Things may change

Champernowne Constant

Time limit8sMemory limit512 MB

Summary
For each query, print the K digits of the Champernowne constant starting at decimal position N, where integers are concatenated in order.
Level

Medium5 of 10

Topics
Math, String matching, Implementation
Solved
No attempts yet

Problem

The Champernowne constant is the irrational number whose decimal expansion is every positive integer written out in increasing order, concatenated after the decimal point. It begins like this.

0.123456789101112…0.123456789101112\dots

Given two natural numbers NN and KK, write a program that prints the KK digits of this constant starting at decimal place NN.

Input

The input has several lines. Each line holds two positive integers NN and KK separated by one space, with N≤109N \le 10^9 and K≤100K \le 100.

The end of the input is a line holding two zeros. Do not process that line.

Output

For each line, print the KK digits on one line with no separators.

Examples5

  1. Example 1

    Input
    4 5
    6 7
    0 0
    
    Expected output
    45678
    6789101
    
  2. Example 2

    Input
    1 1
    1 2
    9 1
    10 1
    11 1
    0 0
    
    Expected output
    1
    12
    9
    1
    0
    
  3. Example 3

    Input
    188 5
    189 2
    190 3
    2888 4
    2889 5
    0 0
    
    Expected output
    99100
    91
    100
    9910
    91000
    
  4. Example 4

    Input
    1 100
    0 0
    
    Expected output
    1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545
    
  5. Example 5

    Input
    1000000000 100
    0 0
    
    Expected output
    1234567901234567911234567921234567931234567941234567951234567961234567971234567981234567991234568001