Eddy likes to play with digits. However, as you may know, Eddy is a programmer not a normal human. Thus, he likes to play with hexadecimal digits(base 16) instead of decimal digits(base 10). One day, he found that sum of digits(

) is very interesting. Then, he invents following function.
After playing with

several times, Eddy found that for one integer, the computation is too easy to make him happy. Thus, Eddy generates a string of hexadecimal digits S, and takes some subsegment(consecutive digits) of it. Then, Eddy takes all the non-empty subsequence(not necessary consecutive digits) from the subsegment as the inputs of the

function. It becomes a little challenging for Eddy now. But, Eddy is still not satisfied. He wants to change the string sometimes and keeps taking some subsegments as queries. Now, it's really a problem for Eddy. You, as one of the friends of Eddy, come to rescue him and are going to compute the answer for him.
Since the number of outputs would be too many(which will be equal to the number of non-empty subsequences), you are only required to compute the number of each output and report the number
%20%5Ctimes%201021%5Ei)%20%5Cmod%2010%5E9%2B7(1000000007))
to Eddy.
For example, the hexadecimal string S equals

. Eddy takes the subsegment [1,1] which is

. All the non-empty subsequence is

. Thus, the answer will be

.
If Eddy takes the subsegment [1,3] which is

. All the non-empty subsequence is

. Then, the answer will be 267411465.