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