Problem A

Weird Mapping between Words and Integers

Consider the following bijection between words from the alphabet {a,b} and the the set of non-negative integers, N:

   f: {a,b}* -> N
           e -> 0 (empty word)
           a -> 1
           b -> 2
          aa -> 3
          ba -> 4
          ab -> 5
          bb -> 6
         aaa -> 7
         baa -> 8

Problem

Your task is to write a program that can transform words from alphabet {a,b} with maximum size less than 30 into the corresponding integers and also transform integers into the corresponding words, according to the mapping defined above.

Input

The input consists of a sequence of lines and each line can either be a word from the alphabet or an integer. It is guaranteed that the given integer corresponds to a word of maximum size less than 30. All the words in the input are non-empty and the integers are greater than zero.

Output

For each line of input, a word or an integer, you should output also in separate lines the corresponding integer or word according to the mapping defined above.

Sample Input

b
5
aaa
18

Sample Output

2
ab
7
bbaa


ICPC/ACM Programming Contest - SWERC'2002 - University of Porto, Portugal