Count the Numbers

You’re given three non-negative integers N (0 ≤ N ≤ 999), A, B, (0 ≤ A ≤ B ≤ 2000000000). Count the number of integers in the interval [A; B] which contain N as a subsequence. For example if N = 3, A = 3 and B = 17, there are two integers which contain N as a subsequence: 3 and 13. Input The input contains triples of numbers A, B and N. The input ends with ‘-1 -1 -1’. This line should not be processed. Output For each triple, output the answer on a new line. Sample Input 3 17 3 0 20 0 0 150 17 -1 -1 -1 Sample Output 2 3 2