#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; ll N; int main() { cin >> N; vector> vt; for(ll i = 1; i*i <= N; ++i) { if(N%i == 0) { vector v = {0,i,N/i}; do { ll x = v[0]; ll y = v[1]; ll z = v[2]; vt.push_back({x,y,z}); } while(next_permutation(v.begin(),v.end())); } } for(ll x = 1; x*x <= N; ++x) { for(ll y = x; y <= N/x+1; ++y) { if(N-x*y > 0 && (N-x*y)%(x+y) == 0) { ll z = (N-x*y)/(x+y); if(z >= y) { vector v = {x,y,z}; do { ll xx = v[0]; ll yy = v[1]; ll zz = v[2]; vt.push_back({xx,yy,zz}); } while(next_permutation(v.begin(),v.end())); } } } } cout << vt.size() << endl; for(auto [x,y,z] : vt) cout << x << " " << y << " " << z << endl; }