Numerically Speaking

No attempts yetTime limit1sMemory limit128 MB

Problem

Every lowercase word whose length is between 1 and 20 is assigned a distinct positive integer. Words are ordered first by length, and within the same length alphabetically, then numbered consecutively starting from 1. The beginning of the list looks like this:

a           1
b           2
...
z          26
aa         27
ab         28
...
snowfall   157,118,051,752
...

This is exactly bijective base-26 numbering: read the word from left to right using a = 1, b = 2, …, z = 26 as digits, and the number of a word of length $k$ with digit values $d_1 d_2 \dots d_k$ is $\sum_{i=1}^{k} d_i \cdot 26^{,k-i}$.

Write a program that translates in both directions: given a word, print its number; given a number, print its word.

Input

The input lists one item per line, each starting in column one. A line whose column one contains a single asterisk (*) marks the end of the input.

Each item is either a number or a word:

  • A number consists only of the decimal digits 09 (there are no commas in the input) and corresponds to some word of length 1 to 20.
  • A word consists of 1 to 20 lowercase letters az.

Output

Print one line for each input item. The word begins in column one and its number begins in column 23; fill the space between them with blanks (that is, place the word in a left-justified field 22 characters wide, immediately followed by the number). Group the digits of the number with commas every three digits from the right (thousands, millions, and so on).