#include using namespace std; vector> ans, nans; int n; void check(int x, int y) { if ((n - x * y) % (x + y) != 0) return; int z = (n - x * y) / (x + y); ans.push_back({ x, y, z }); } int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n; for (int xy = 1; xy * xy <= n; xy ++) { for (int i = 1; i * i <= xy; i ++) if (xy % i == 0) { int x = i, y = xy / i; check(x, y); if (x != y) check(y, x); } } for (int i = 1; i * i <= n; i ++) if (n % i == 0) { int y = i, z = n / i; if (y > z) swap(y, z); ans.push_back({ 0, y, z }); } for (auto [x, y, z] : ans) { vector arr{ x, y, z }; vector p{ 1, 2, 3 }; do { nans.push_back({ arr[p[0] - 1], arr[p[1] - 1], arr[p[2] - 1] }); } while(next_permutation(p.begin(), p.end())); } sort(nans.begin(), nans.end()); nans.erase(unique(nans.begin(), nans.end()), nans.end()); cout << nans.size() << "\n"; for (auto [x, y, z] : nans) cout << x << " " << y << " " << z << "\n"; return 0; }