2019.10.20 is the 110th birthday of HPU. On that day, you can see the string "110" everywhere.
Hery is given an integer n in decimal, he can transform n to a **binary string** S. For example:
_%7B10%7D%3D(110)_2)
, so 6 can be transformed to "110". But hery thinks S is too short, so he constructs n's **birthday string** T by repeating n's **binary string** S for n times. So for n=6, n's **birthday string** T is:
"110110110110110110"
For n's **birthday string** T, hery wants you to calculate how many pairs (i,j,k) satisfy

and

.