B. Bad LaTeX
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Tomorrow is the Gran Premio de Mexico 2026 Primera Fecha, and you are in a hurry to finish setting all the problems for tomorrow's contest. Since two heads are better than one, you asked your friend Jimbo to help you out with the statements of the problems. However, this quote didn't end up being true — Jimbo wrote the statements but without respecting some writing style rules!

For an easier read, you want to ensure that the following rules are held:

  • If an integer value is a power of $$$10$$$ with $$$k \geq 4$$$ zeros, you write them as a power of $$$10$$$ instead of its whole representation.

    For example, if Jimbo wrote $$$1000000000$$$, then you must transform it to $$$10^{9}$$$ in LaTeX, so the final text would be 10^{9}.

  • If an integer value ends with $$$k \geq 4$$$ zeros, you write them in an special scientific notation: You write a truncated real equivalent of the value with only 1 digit in the integral part and then multiply this real by the corresponding power of ten.

    For example, if Jimbo wrote $$$123400000$$$, then you must transform it to $$$1.234 \cdot 10^{8}$$$ in LaTeX, so the final text would be 1.234\cdot10^{8}

  • These rules only apply to integers that are not subscripts or superscripts or affected by any of them. Any other value is kept as it is.

Since you are very tired from setting up the solutions, validators and testcases, you will automatize this process by writing a program that applies these rules on the statements.

Input

The first line of input contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — The number of lines of a given statement.

The following $$$n$$$ lines of input contain a string $$$s_{i}$$$ ($$$1 \leq |s_{i}| \leq 1000$$$) – The $$$i$$$-th line contains the $$$i$$$-th line of the given statement.

It is guaranteed that the statement will only consist of letters (could be in lowercase or uppercase), digits, spaces and special symbols (!?.,;$#^{}_=+*) and there won't be any leading or trailing space. Consider that if a line ends with an integer and the next one starts with an integer, these two are not part of the same value.

Output

Print $$$n$$$ lines — The $$$i$$$-th line must contain the $$$i$$$-th line of the statement after applying the rules.

Example
Input
4
This example shows a value
Of 1000000000 without being compressed to 10^{9}
Which is annoying when read. $ S_{10} = 2^{100000} + 780000 $
My ID is RA180000 but that was back in the year 20000
Output
This example shows a value
Of 10^{9} without being compressed to 10^{9}
Which is annoying when read. $ S_{10} = 2^{100000} + 7.8\cdot10^{5} $
My ID is RA180000 but that was back in the year 2\cdot10^{4}