Problem E: Metal Powers


I suppose everyone here has heard of the famous golden ratio φ = ≈ 1.618. This number possesses numerous interesting properties, one of which is illustrated by the following brain-teaser:

"What is the 200th significant digit of φ600 (φ to the 600th power)?"

The answer is 9. This is because φn + (1 - φ)n is an integer for any positive integer n, and (1 - φ)600 is an extremely small positive number.

In this problem we introduce two more "metal ratios": the silver ratio ≈ 2.414 and the bronze ratio ≈ 3.303. (These terms are certainly not made up by us; try searching "silver ratio" in MathWorld and you'll see the numbers. Oh wait, Bronze is NOT a metal, hmm...) Curiously, each of these three ratios, when raised to the nth power (for n large enough), is very close to an integer. (Perhaps it is not that curious for those who know difference equations.) Let us call these approximate integers "the Metal Powers". Your job is to write a program that computes them.

Input

Input has no more than 250 lines, each containing a value of n (0 ≤ n ≤ 100000000) followed by one of the uppercase letters "G" (for "Golden"), "S" (for "Silver") or "B" (for "Bronze").

Output

For each case, your program should give the corresponding "Metal Power". (For example, the 600th Golden Power means the closest integer to φ600.) If any result contains more than nine digits, you only need to give its first three and last three significant digits, together with its total number of digits, as shown in the sample output. You must use the suffixes "th", "st", "nd" and "rd" appropriately.

Sample Input

0 G
2 S
27 B

Sample Output

The 0th Golden Power is 1.
The 2nd Silver Power is 6.
The 27th Bronze Power is 102...036(15 digits).

Explanation

The exact value for the third sample case is:

102266868132036


Problemsetter: Mak Yan Kei
Images taken from Wikimedia Commons