# AOJ 1209: Square Coins

#Python3 2018.7.19 bal4u



N = 18

tbl = [i**2 for i in range(0, N)]

dp = [[0 for j in range(600)] for i in range(N)]

dp[0][0] = 1

for i in range(1, N):

    for n in range(300):

        dp[i][n] += dp[i-1][n]

        for j in range(tbl[i], 300, tbl[i]):

            dp[i][n+j] += dp[i-1][n]



while True:

    n = int(eval(input()))

    if n == 0: break

    print((dp[N-1][n]))





# AOJ 1209: Square Coins

#Python3 2018.7.19 bal4u



dp = [1]*300

for i in range(2, 18):

    for j in range(i**2, 300): dp[j] += dp[j-i**2]



while True:

    n = int(eval(input()))

    if n == 0: break

    print((dp[n]))



# AOJ 1209: Square Coins
# Python3 2018.7.19 bal4u
N = 18
tbl = [i**2 for i in range(0, N)]
dp = [[0 for j in range(600)] for i in range(N)]
dp[0][0] = 1
for i in range(1, N):
    for n in range(300):
        dp[i][n] += dp[i - 1][n]
        for j in range(tbl[i], 300, tbl[i]):
            dp[i][n + j] += dp[i - 1][n]
while True:
    n = int(eval(input()))
    if n == 0:
        break
    print((dp[N - 1][n]))

# AOJ 1209: Square Coins
# Python3 2018.7.19 bal4u
dp = [1] * 300
for i in range(2, 18):
    for j in range(i**2, 300):
        dp[j] += dp[j - i**2]
while True:
    n = int(eval(input()))
    if n == 0:
        break
    print((dp[n]))

-N = 18 -tbl = [i**2 for i in range(0, N)] -dp = [[0 for j in range(600)] for i in range(N)] -dp[0][0] = 1 -for i in range(1, N): -    for n in range(300): -        dp[i][n] += dp[i - 1][n] -        for j in range(tbl[i], 300, tbl[i]): -            dp[i][n + j] += dp[i - 1][n] +dp = [1] * 300 +for i in range(2, 18): +    for j in range(i**2, 300): +        dp[j] += dp[j - i**2] -    print((dp[N - 1][n])) +    print((dp[n]))