#2646. Count

Count

Background

Special for beginners, ^_^

Description

给定正整数N和M,将1到10^N-1的数字写在字符串上,例如N=2,字符串则是 “123456789101112„9899”。问:M在字符串中出现了多少次? N < = 15,M< = 10^6.

Format

Input

Output

Samples

2 1
2 10
2 11
2 78
0 0
20
1
2
3

Limitation

1s, 1024KiB for each test case.