Sum of Cubes

Write N as a sum of as few positive cubes as possible, and among the shortest sums output the one that is lexicographically largest.

Medium7Dynamic programmingBrute forceMathImplementationNo attempts yetTime limit0.5sMemory limit256 MB

Problem

You are given a natural number NN. Write NN as a sum of cubes of natural numbers using as few terms as possible. That is, find natural numbers m1,m2,,mkm_1, m_2, \ldots, m_k with

m13+m23++mk3=Nm_1^3 + m_2^3 + \cdots + m_k^3 = N

where kk is as small as possible. The same number may be used more than once.

Input

The first and only line contains the natural number NN (1N44,777,4441 \le N \le 44{,}777{,}444).

Output

Print two lines. The first line contains kk, the minimum number of cubes. The second line contains kk natural numbers whose cubes add up to NN, separated by single spaces and sorted so that no number is smaller than the number after it.

If several sets of kk numbers work, print the one that comes first in lexicographic order. Compare two sets at the first position where they differ, and the set with the smaller number there comes first. For N=1729N = 1729 both 123+1312^3 + 1^3 and 103+9310^3 + 9^3 use two cubes, so the answer is 10 9.