program simulator;
var
a:array[0..10001]of longint;
b:array[0..10001]of real;
i,j,c,v,n:longint;
s:char;
begin
assign(input,'simulator.in');
assign(output,'simulator.out');
reset(input);
rewrite(output);
read(V,C);
a[0]:=V; b[0]:=(C/100)*100;
readln(n);
j:=0;
for i:=1 to n do begin
read(s);
if s='P' then begin
readln(V,C);
inc(j);
a[j]:=a[j-1]+V;
b[j]:=(a[j-1]*b[j-1]+c*v)/a[j];
write(a[j],' ',b[j]:0:5);
writeln;
end
else begin
if j>0 then dec(j);
write(a[j],' ',b[j]:0:5);
writeln;
readln;
end;
end;
close(input); close(output);
end.