program nongdujisuan;
var
a:array[0..10000]of longint;
b:array[0..10000]of real;
t,k,n,v0,c0,b1,c:longint;
a1:char;
begin
assign (input,'simulator.in');
reset (input);
assign (output,'simulator.out');
rewrite (output);
readln (v0,c0);
readln (n);
a[0]:=v0;
b[0]:=c0;
repeat
k:=k+1;
t:=t+1;
read (a1);
if a1='P' then
begin
readln (b1,c);
a[t]:=a[t-1]+b1;
b[t]:=(b[t-1]/100*a[t-1]+c/100*b1)/a[t]*100;
writeln (a[t],' ',b[t]:0:5)
end
else
begin
readln;
t:=t-2;
if t<0 then
t:=0;
writeln (a[t],' ',b[t]:0:5)
end
until k=n;
close (input);
close (output)
end.