b=[1,2,4,6,9,12]
s=1*1+2*2+3*2+4*3+5*3
i=3
m=5
while s < 10**18:
for x in range(b[i-1],b[i]):
for z in range(i):
s+=len(b)*x
b.append(x+b[m])
m+=1
i+=1
r=s=i=1
for n in range(2,10**6):
while s < n**3:
s+=(b[i+1]-b[i])*(i+1)
i+=1
r+=(n**3-(s-(b[i]-b[i-1])*i)-1)/i+b[i-1]
print r