Series of numbers#4194

Series of numbers

1 second
64 megabytes
Medium

The natural numbers are written in sequence to form the following series:

123456789101112131415161718192021222324…

In this sequence, your task is to determine the position of the first digit in the first occurrence of consecutive digits .

Input

The input consists of a single line containing two integers, and (d = 0..9). The input is guaranteed such that the result will not exceed 10^9.

Output

Answer to the problem.

Examples

Example 1

Loading
Loading