program bai1;
var i,n,s,t:longint;
function tt(a:longint):longint;
var i,s:longint;
begin
s:=1;
for i:=1 to a do
s:=s*a;
tt:=s;
end;
begin
write('N= ');readln(n);
s:=0;
for i:=1 to n do
begin
t:=tt(i);
s:=s+t;
end;
write('Tong la: ',t);
readln
end.