""" https://yukicoder.me/problems/no/2358 全部出力なので、少ないことがわかる xを固定してみよう x(y+z)+yz = N なんか、一つしか存在しなさそうな見た目 N % gcd(x,y) = 0 N % gcd(x,z) = 0 を利用する? y = gY z = hZ gX(gY+hZ) + gYhZ = 0 x,y,z のgcdを考える? とりあえず x <= y <= z とするか… xは10^3未満 yもね ab+c(a+b) == N """ import sys import itertools N = int(input()) ans = [] for a in range(3164): for b in range(a,3164): rem = N - a*b if a+b == 0: continue if rem % (a+b) == 0: c = rem // (a+b) if b <= c: s = set() for p in itertools.permutations([a,b,c]): tup = tuple(p) s.add(tup) for tup in s: ans.append(tup) print (len(ans)) for x,y,z in ans: print (x,y,z)