Program simulator;
Type
abc=record
m:int64;
c:real;
x:boolean;
end;
sc=array [0..10000] of abc;
Var
i,j:longint;
n:longint;
s:sc;
p,pp,o,tm:int64;
k:char;
tc,m:real;
Begin
assign(input,'simulator.in');
assign(output,'simulator.out');
reset(input);
rewrite(output);
readln(s[0].m,s[0].c);
readln(n);
s[0].c:=s[0].c/100;
s[0].x:=true;
for i:=1 to n do begin
read(k);
if k='P' then begin
read(k);
readln(tm,tc);
m:=s[i-1].m*s[i-1].c;
m:=m+tm*(tc/100);
s[i].m:=s[i-1].m+tm;
s[i].c:=m/s[i].m;
s[i].x:=true;
end
else begin
p:=i;
while (s[p].x=false)and(p>0) do p:=p-1;
if p>0 then begin
s[i].m:=s[p-1].m;
s[i].c:=s[p-1].c;
end
else begin
s[i].m:=s[0].m;
s[i].c:=s[0].c;
end;
readln;
end;
writeln(s[i].m,' ',(s[i].c*100):0:5);
end;
close(input);
close(output);
End.