Potassium, a genius who masters soul conversion, is observing the world line of Potas. The world line can be divided into

parts and represented as an

-digit decimal number

(may have leading zeros) that reveals the property of time in the past and future of Potas.
For convenience, let

denote the concatenation of digits

, so the world line can be expressed as

. When observing, Potassium focuses on the era, which consists of continuous parts in the world line. An era beginning from part

to

can be denoted as

(

), and may also have leading zeros.
When two eras are quite similar, Potassium can observe one from another by Spirit Circle. More specifically, an era

can be observed from another era

by Spirit Circle if and only if the following two conditions are satisfied, regardless of where

and

locate in

originally.
1.

and

have the same length, i.e.

;
2.

is greater than

by exactly

, i.e.

.
Potassium is wondering: how many different pairs
)
can be found in

that he can observe era

from era

. Note that two eras having the same representations but differing in the original location in

are considered as different eras.