Oneness

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Define oneness of the number xx to be a number of integers d>1d > 1 dividing xx, whose decimal representation consists only of digit 11. For example, oneness(121)=1oneness(121) = 1 and oneness(1221)=2oneness(1221) = 2.

Number nn is obtained using the following algorithm involving a pseudo-random number generator. You are given two integers ll and s_0s\_0, which are the length of the decimal representation of nn and the generator seed.

The digits d_0d_1d_l1d\_0d\_1 \ldots d\_{l-1} of the number nn are generated by the following recursions:

d_i=s_i/1024mod10s_i+1=(747796405s_i1403630843)mod232d\_i = \left\lfloor s\_i / 1024 \right\rfloor \mod 10 \\\ s\_{i + 1} = (747796405 s\_i - 1403630843) \mod 2^{32}

It is guaranteed that d_0d\_0 is non-zero.

Calculate the total oneness over all integers between 11 and nn.

입력

The first line contains two integers ll, ss (1l250,0001\le l \le 250\\,000, 0s_0<2320 \leq s\_0 < 2^{32}), the number of digits in the decimal representation of nn and the seed of pseudo-random number generator that is used to create the decimal representation of nn.

출력

Output the sum of oneness over all integers between 11 and nn.

힌트

In sample tests nn equals 1, 11, 1221 and 9359 respectively.