After getting their Registration IDs, now the students were curious to know the names of the various events. So, this time, the volunteers told the participants that they would be given a Special Compressed String which they are supposed to Decompress to know the particular event name. Now, each Compressed string is an alphanumeric String which is to be decompressed using the rule stated below:

Whenever you encounter a number in a string, print the part of the string preceding the number, that many times.

So, help the participants Decompress the Strings.

Input:

First line contains t, the number of test cases, then t lines follow each containing a alphanumeric string.

Output:

Print the Decompressed String

Constraints:

1 ≤ t ≤ 50

10 ≤ |s| ≤ 20

1 ≤ (numbers that appear in the string) ≤ 9

SAMPLE INPUT
2
a3
a2b3

SAMPLE OUTPUT
aaa
aabaabaab
for t in range(input()):
 s=raw_input()
 ch=""
 l=len(s)
 for i in range(0,l,1):
  if (s[i]>='a' and s[i]<='z') or (s[i]>='A' and s[i]<='Z'):
   ch=ch+s[i]
  else:
   x=ch
   limit=int(s[i])-1
   for j in range(0,limit,1):
    ch=ch+x
 print ch