uses crt;
var n,i:integer;
s:real;
{---------------------------chuong-trinh-con----------------------------}
function gthua(x:integer):real;
var i:integer;
gt:real;
begin
gt:=1;
for i:=1 to x do
gt:=gt*i;
gthua:=gt;
end;
{---------------------------chuong-trinh-chinh-----------------------------}
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
i:=1;
while s<=30000 do
begin
s:=s+gthua(i);
i:=i+1;
end;
writeln(s:4:2);
readln;
end.