SP10476 IOPC1206 - Fair bases

Description

Consider integers N and K such that 2 As an example, suppose N=4 and K=3. Then the numbers in the list are 00,01,02 and 10. Let us find the score of i=00. The first digit of i appears as the first digit thrice (00,01,02) and the second digit of i appears as second digit twice (00,10). Thus the score of 00 is 3+2=5. An integer K (2 Given integers a and b (2

Input Format

The first line of input contains T, the number of test cases (T

Output Format

For each (a,b) pair in the input, output the sum of fairness factors of i in the range a