Problem E

Recursive Texting

 

All of you have typed in mobile phones. In this problem, you will have to do a similar thing.

 

 

You are given a word. You will have to process it. There are two phases in each step.

Type the given word using standard mobile keyboard, that is, press the digit containing the required letter once.

 

Convert each digit found in the first phase into word, concatenate those words, and produce a new word.

 

For example, if you are asked to type DHAKA.

 

Step 1, phase 1:

34252

 

Step 1, phase 2:

THREEFOURTWOFIVETWO

 

Step 2, phase 1:

8473336878963483896

 

Step 2, phase 2:

EIGHTFOURSEVENTHREETHREETHREESIXEIGHTSEVENEIGHTNINESIXTHREEFOUREIGHTTHREEEIGHTNINESIX

 

And so on….

 

Your job is to find the kth character after nth step.

 

 

Input

 

First line of input will consist of number of test cases, T (1 <= T <= 1000). Each of the next T lines contains the initial word, W (1 <= |W| <= 100), n(1<=n<=20), k (1 <= k <= 10^9), separated by a space. n will be such that kth character is always found. The initial word will contain only uppercase letter of English alphabet and no space within it.

 

 

Output

 

For each test case, first print the test case number, followed by the kth character after processing the initial word up to nth step.

 

 

Sample Input

Output for Sample Input

4

DHAKA 1 1

DHAKA 2 1

DHAKA 1 5

DHAKA 2 10

 

Case 1: T

Case 2: E

Case 3: E

Case 4: S

 

 

Note

Spellings of the digits:

0 – ZERO, 1 – ONE, 2 – TWO, 3 – THREE, 4 – FOUR, 5 – FIVE, 6 – SIX, 7 – SEVEN, 8 – EIGHT, 9 – NINE

 

 

Problemsetter: Anna Fariha, Shiplu Hawlader

Special Thanks: Md. Mahbubul Hasan