program simulator;
const
maxn = 10000;
var
V,C: array[0..maxn] of extended;
n: longint;
s: char;
procedure init;
begin
readln(V[0],C[0]);
C[0] :=C[0];
end;
procedure main;
var
i: longint;
len: longint;
Vi,Ci: extended;
begin
readln(N);
len :=0;
for i :=1 to n do begin
read(s);
if s = 'P'
then begin
readln(Vi,Ci);
inc(len);
V[len] :=V[len-1] + Vi;
C[len] :=(V[len-1]*C[len-1]+Vi*Ci) /(V[len-1]+Vi);
writeln(V[len]:0:0,' ',C[len]:0:5)
end
else begin
dec(len); if len <0 then len :=0;
writeln(V[len]:0:0,' ',C[len]:0:5);
readln;
end;
end;
end;
begin
assign(input,'simulator.in'); reset(input);
assign(output,'simulator.out'); rewrite(output);
init;
main;
close(input); close(output);
end.