const _C : array [1..3] of char = ('P','U','I'); _P : array [1..3] of char = ('m','k','M'); _U : array [1..3] of char = ('W','V','A'); _k : array [1..3] of real = (1e-3,1e3,1e6); var f: text; co:byte; o:array [1..3] of byte; k:array [1..3] of real; z:array [1..3] of real; c:char; s:string; count,code:integer; e:string; p: array [1..2] of string; i,j,m,n:integer; t:string; begin assign(f,'ai.in');reset(f);co:=1; s:='';c:='1'; while c<>#13 do begin read(f,c); if c in ['1'..'9'] then s:=s+c; end; read(f,c);val(s,count,code); for i:=1 to count do begin readln(f,s);e:='';n:=1; p[1]:='';p[2]:=''; for j:=1 to length(s) do if s[j]='=' then begin p[n]:=s[j-1]+'='+p[n]; m:=j+1; while not (s[m] in [' ',',',#13,#0]) do begin p[n]:=p[n]+s[m];inc(m); end; if p[n][length(p[n])]='.' then delete(p[n],length(p[n]),1); inc(n); end; for m:=1 to 2 do for n:=1 to 3 do if p[m][1]=_c[n] then o[m]:=n; for n:=1 to 3 do k[n]:=1; for m:=1 to 2 do for n:=1 to 3 do if p[m][length(p[m])-1]=_p[n] then k[m]:=_k[n]; for m:=1 to 2 do begin t:=''; for n:=3 to length(p[m]) do if p[m][n] in ['0'..'9','.'] then t:=t+p[m][n]; if t[length(t)]='.' then delete(t,length(t),1); val(t,z[m],code); end; if (o[1]<>1) and (o[2]<>1) then begin z[3]:=(z[1]*k[1])*(z[2]*k[2]);o[3]:=1;end; if (o[1]=1) and (o[2]<>1) then begin z[3]:=(z[1]*k[1])/(z[2]*k[2]);if o[2]=2 then o[3]:=3 else o[3]:=2;end; if (o[1]<>1) and (o[2]=1) then begin z[3]:=(z[2]*k[2])/(z[1]*k[1]);if o[1]=2 then o[3]:=3 else o[3]:=2;end; writeln('Задача #',co); writeln(_c[o[3]],'=',z[3]:1:2,_u[o[3]]); writeln; inc(co); end; close(f); end.