program ex;
type
data=record
v:longint;
c:real;
end;
ss=array[0..10000]of data;
var
f:ss;
tail:integer;
n,v1,c1,t:longint;
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);
tail:=0;
for i:=1 to n do
begin
read(ch);
if ch='Z' then begin
readln;
if tail>0 then dec(tail);
end
else begin
read(v1,c1);
readln;
inc(tail);
f[tail].v:=f[tail-1].v+v1;
f[tail].c:=(f[tail-1].c*f[tail-1].v+v1*c1)/(f[tail].v);
end;
writeln(f[tail].v,' ',f[tail].c:0:5);
end;
close(input);
close(output);
end.