program simulator;
var
a1:array[0..10000] of longint;
a2:array[0..10000] of real;
i,j,c,v,vv,n,ii:longint;
cc:real;
r:char;
begin
assign(input,'simulator.in');
assign(output,'simulator.out');
reset(input);
rewrite(output);
read(v,c);
a1[0]:=v;
a2[0]:=(c/100)*100;
readln(n);
ii:=0;
for i:=1 to n do
begin
read(r);
if r='P' then
begin
inc(ii);
readln(v,c);
a1[ii]:=v+a1[ii-1];
a2[ii]:=(a1[ii-1]*a2[ii-1]+v*c)/a1[ii];
write(a1[ii],' ',a2[ii]:0:5);
writeln;
end
else
begin
readln;
dec(ii);
if ii<0 then ii:=0;
write(a1[ii],' ',a2[ii]:0:5);
writeln;
end;
end;
close(input);
close(output);
end.