Under construction

Still being built. Things may change

Almost Favorite Numbers

Interview

Time limit0.5sMemory limit1024 MB

Summary
Count the integers from 1 to m whose decimal representation ends with the digits of n.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Deadpool is very fickle, so his favorite number changes every day. Since he has only one at a time, he invented the idea of an "almost favorite number" for the times when he needs several numbers.

A number is almost favorite if its decimal representation ends with Deadpool's favorite number. For example, if the favorite number is 2525, then 625625, 1122511225, and 2525 are almost favorite, while 55 and 22552255 are not.

Deadpool hates limits, but this world cannot do without them. He needs a program that counts the almost favorite numbers not exceeding mm.

Deadpool has many orders, so please help him write this program.

Input

The single line of the input file contains two integers nn and mm (1≤n≤m≤2⋅1091 \le n \le m \le 2 \cdot 10^9): Deadpool's favorite number and the upper bound on the size of an almost favorite number.

Output

Print one integer: the number of almost favorite numbers not exceeding mm.

Examples3

  1. Example 1

    Input
    5 15
    
    Expected output
    2
    
  2. Example 2

    Input
    1 100
    
    Expected output
    10
    
  3. Example 3

    Input
    23 122
    
    Expected output
    1