#P5936. Difference

Difference

Problem Description

Little Ruins is playing a number game, first he chooses two positive integers $y$ and $K$ and calculates $f(y, K)$, here

$$f(y, K) = \sum_{z\text{ in every digits of }y} z^K (f(233, 2) = 2^2 + 3^2 + 3^2 = 22)$$

then he gets the result

$$x = f(y, K) - y$$

As Ruins is forgetful, a few seconds later, he only remembers $K$, $x$ and forgets $y$. please help him find how many $y$ satisfy $x = f(y, K) - y$.

Input

First line contains an integer $T$, which indicates the number of test cases.

Every test case contains one line with two integers $x$, $K$.

Limits
$1 \leq T \leq 100$
$0 \leq x \leq 10^9$
$1 \leq K \leq 9$

Output

For every test case, you should output 'Case #x: y', where x indicates the case number and counts from 1 and y is the result.

2 2 2 3 2
Case #1: 1 Case #2: 2