def compute(n):
M[0][n]=M[1][n]=n
k,step=1,n+1
for s in range(1,step+1):
for m in range(1,s+1):
for v in range(n+1):
value=M[k][((m-1)<<10)+v]+s-m+1
if value>=step:
value=0
M[k][(m<<10)+v]=M[1-k][((m-1)<<10)+value]
value,v=M[k][(s<<10)],1
while v<=n and M[k][(s<<10)+v]==value:
v+=1
if v>n:
return value
k=1-k
return M[1-k][(step<<10)]
M=[[0]*(1<<20),[0]*(1<<20)]
print sum(compute(i)**3 for i in range(0,1000+1))