- Listen, Misha, they told us at school that there is a city somewhere in the world called Lviv, and there, young and handsome people claim that the lucky digits are 4 and 7 .
- So what?...
- So, Misha, I came up with my own lucky number — 47 . And I will be happy every time, in any number up to the given one, when these two digits appear together, forming my lucky number!
- Well, Mashenka, then you will be less happy than those boys from Lviv and much less often.
- Well, but I'm a girl!!!
The first line contains a natural number (0 \le T \le 10^4) — the number of test cases. Each of the next lines contains a natural number not exceeding 2^{63} - 1.
For each test case, print on a separate line the number of occurrences, among all natural numbers up to and including the given one, of Masha's lucky number as a contiguous digit subsequence.
Primer 1