#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; string to_s(int x, int y, int z) { return to_string(x) + " " + to_string(y) + " " + to_string(z); } int main() { int N; cin >> N; vector ans; map> checked; int x = 0; while (x * x <= N) { int y = x; while (y * y <= N) { if (x + y != 0) { if ((N - x * y) % (x + y) == 0) { int z = (N - x * y) / (x + y); if (not checked[x][y]) { checked[x][y] = true; ans.push_back(to_s(x, y, z)); } if (not checked[x][z]) { checked[x][z] = true; ans.push_back(to_s(x, z, y)); } if (not checked[y][x]) { checked[y][x] = true; ans.push_back(to_s(y, x, z)); } if (not checked[y][z]) { checked[y][z] = true; ans.push_back(to_s(y, z, x)); } if (not checked[z][x]) { checked[z][x] = true; ans.push_back(to_s(z, x, y)); } if (not checked[z][y]) { checked[z][y] = true; ans.push_back(to_s(z, y, x)); } } } ++y; } ++x; } cout << ans.size() << endl; for (string s : ans) { cout << s << endl; } return 0; }