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