//* Problem  : 1165 - Artificial Intelligence?
//* Contest  : acm.tju.edu.cn
//* Type     : Solution
//* Date     : 2007.07.27
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 6.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

char s[10000];

char ch;
double res;

void solve()
{
	int fP, fI, fU; fP = fI = fU = 0;
	double baseP, expP, baseI, expI, expU, baseU, b, e;
	char *str, *p;
	str = strchr(s, '=');
	sscanf(str+1, "%lf", &b);
	p = str+1;
	while (p[0] == '.' || (p[0]>='0' && p[0] <= '9')) p++;
	if (p[0] == 'm') e = 0.001;
		else if (p[0] == 'k') e = 1000.0;
			else if (p[0]=='M') e = 1000000.0;
				else e = 1.0;
	if (str[-1] == 'U')
	{
		fU = 1; expU = e; baseU = b;
	}
	else if (str[-1] == 'I')
	{
		fI = 1; expI = e; baseI = b;
	}
	else
	{
		fP = 1; expP = e; baseP = b;
	}
	str = strchr(str+1, '=');
	sscanf(str+1, "%lf", &b);
	p = str+1;
	while (p[0] == '.' || (p[0]>='0' && p[0] <= '9')) p++;
	if (p[0] == 'm') e = 0.001;
		else if (p[0] == 'k') e = 1000.0;
			else if (p[0]=='M') e = 1000000.0;
				else e = 1.0;
	if (str[-1] == 'U')
	{
		fU = 1; expU = e; baseU = b;
	}
	else if (str[-1] == 'I')
	{
		fI = 1; expI = e; baseI = b;
	}
	else
	{
		fP = 1; expP = e; baseP = b;
	}
///////////////
	if (!fP)
	{
		ch = 'P'; res = expI * expU * baseI * baseU;
	}
	else if (!fI)
	{
		ch = 'I'; res = expP * baseP / (expU * baseU);
	}
	else
	{
		ch = 'U'; res = expP * baseP / (expI * baseI);
	}
}

int main()
{
	int nt, it;
	gets(s); sscanf(s, "%i", &nt);
	for (it = 1; it <= nt; it++)
	{
		gets(s);
		solve();
		printf("Problem #%i\n", it);
		if (ch == 'P') printf("P=%.2lfW\n\n", res);
			else if (ch == 'I') printf("I=%.2lfA\n\n", res);
				else printf("U=%.2lfV\n\n", res);
	}
}