#include using namespace std; using ll = long long; int main() { ll N; cin >> N; vector> ans; auto push = [&](ll a, ll b, ll c) { ans.push_back({a, b, c}); ans.push_back({a, c, b}); ans.push_back({b, a, c}); ans.push_back({b, c, a}); ans.push_back({c, a, b}); ans.push_back({c, b, a}); }; for (int i = 1; i * i <= N; i++) { if (N % i != 0) continue; int j = N / i; push(0, i, j); } for (ll x = 1; x <= N; x++) { for (ll y = x; x * y <= N; y++) { if ((N - x * y) % (x + y) != 0) continue; ll z = (N - x * y) / (x + y); push(x, y, z); } } sort(ans.begin(), ans.end()); vector> n; for (auto p : ans) { if (n.size() == 0 || n.back() != p) { n.push_back(p); } } cout << n.size() << "\n"; for (auto [x, y, z] : n) { cout << x << " " << y << " " << z << "\n"; } }