scale = {
  "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,
}

n = gets.to_i
n.times do
  s = gets.chomp
  s =~ /^(\S+) (\w+ )?(\w+)$/
  if $1[0] == ?0
    e = -1
    e -= 1 until $1[1 - e] != ?0
    precision = $1.size + e - 1
    x = $1[1 - e] + (precision > 1 ? ?. : "") + $1[2-e..-1]
  elsif $1.count(?.) > 0
    precision = $1.size - 1
    e = 0
    e += 1 until $1[e + 1] == ?.
    x = $1[0] + ?. + $1[1..e] + $1[e+2..-1]
  else
    precision = $1.size
    e = $1.size - 1
    x = $1[0] + ?. + $1[1..-1]
  end
  e += scale[$2.strip] if $2
  unit = $3
  printf("%s * 10^%d %s\n", x, e, unit)
end
