const y:real=0;
var x:string;
i,j,k,ind:integer;
power,z:real;
begin
	readln(x);
	readln(z);
	for i :=1 to ord(x[0]) do
	begin
			val(x[i],j,k);
			ind:=ord(x[0])-i;
			power:=0;
			if j<>0 then power:=j* exp(ind*ln(z));
			y:=y+power;
	end;
	writeln(y:8:2);
	readln;
end.