program Project2; {$APPTYPE CONSOLE} uses math; var cl, c2, c3, s, h,d1,d2,n:int64; begin readln(n); cl:=trunc(power(n,1/3)+0.5); c2:=trunc(sqrt(n/cl)+0.5); c3:=trunc(n/(cl*c2)) ; S:=3*cl*c2*c3+2*(cl*c2+cl*c3+c2*c3)+ (cl+c2+c3); h:=n-cl*c2*c3; if h<>0 then begin d1:=trunc(power(h,1/2)+0.5); if d1*d1>h then dec(d1); d2:=trunc(h/d1) ; s:=s+3*d1*d2+2*(d1+d2)+1 ; h:=h-d1*d2; if h<>0 then s:=s+3*h+2; end; writeln (s); readln; end.