var n,i:byte; sum,k:longint;begin readln(n); while n<>0 do begin for k:=1 to n do begin sum:=sum+k*k; end; writeln(sum); readln(n); sum:=0; end;end.