program ex;
type
data=record
v:integer;
c:real;
end;
ss=array[0..10000]of data;
var
f:ss;
head,tail:integer;
n,v1,c1:integer;
i,j:integer;
ch:char;
begin
assign(input,'simulator.in');
assign(output,'simulator.out');
reset(input);
rewrite(output);
readln(f[0].v,f[0].c);
readln(n);
for i:=1 to n do
begin
read(ch);
if ch='p' then begin
readln(v1,c1);
f[i].v:=f[i-1].v+v1;
f[i].c:=(f[i-1].c*f[i-1].v+v1*c1)/(v1+f[i-1].v);
end
else f[i]:=f[i-2];
end;
for i:=1 to n do
begin
write(f[i].v,' ');
writeln(f[i].c:0:5);
end;
close(input);
close(output);
end.