import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;


enum int[string] unit = [
    "yotta" : 24,
    "zetta" : 21,
    "exa"   : 18,
    "peta"  : 15,
    "tera"  : 12,
    "giga"  : 9,
    "mega"  : 6,
    "kilo"  : 3,
    "hecto" : 2,
    "deca"  : 1,
    "deci"  : -1,
    "centi" : -2,
    "milli" : -3,
    "micro" : -6,
    "nano"  : -9,
    "pico"  : -12,
    "femto" : -15,
    "ato"   : -18,
    "zepto" : -21,
    "yocto" : -24
];

void main() {
    string[] xs;
    void input() {
        xs = readln.chomp.split(" ").array;
    }
    alias Tuple!(string, int) P;
    P norm(string s) {
        string[] ss = s.split(".");
        if (ss.length == 1) {
            if (s.length == 1) return P(s, 0);
            return P(s[0] ~ "." ~ s[1 .. $], cast(int)s.length - 1);
        }
        if (ss[0] == "0") {
            int i;
            for (i = 0; ss[1][i] == '0'; i++) {}
            string t = ss[1][i .. $];
            if (t.length == 1) return P(t,  - i - 1);
            return P(t[0] ~ "." ~ t[1 .. $], - i - 1);
        } else {
            s = ss[0];
            auto t = ss[1];
            if (s.length == 1) return P(s, 0);
            return P(s[0] ~ "." ~ s[1 .. $] ~ t, cast(int)(s.length - 1));
        }
    }
    void solve() {
        auto p = norm(xs[0]);
        if (xs.length == 3) {
            p[1] += unit[xs[1]];
        }
        if (xs.length == 2) {
            writeln(p[0], " * 10^", p[1], " ", xs[1]);
        } else {
            writeln(p[0], " * 10^", p[1], " ", xs[2]);
        }
    }
    int T; scanf("%d\n", &T);
    foreach (t; 0 .. T) {
        input; solve;
    }
}