#include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef templete #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() //#include //using namespace boost::multiprecision; using namespace std; using namespace atcoder; //using atmint = modint998244353; using atmint = modint; using Graph = vector>; using P = pair; //#pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; templatebool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } templatebool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } //--------------------------------------------------------------------------------------------------- #endif // templete //--------------------------------------------------------------------------------------------------- void _main() { ll n; cin >> n; vector>ans; for(ll x = 1; x <= n; x++){ ll maxy = n / x; for(ll y = 1; y <= maxy; y++){ ll r = n - x * y; ll l = x + y; ll z = r / l; if(z == 0)continue; if(r % l != 0)continue; ans.push_back({x,y,z}); // if(r % l == 0)ans.emplace_back(x,y,z); //if(r % l == 0)ans.push_back({x,y,z}); } } for(ll y = 1; y <= n; y++){ if(n % y == 0){ /* ans.emplace_back(0,y,n/y); ans.emplace_back(n/y,0,y); ans.emplace_back(y,n/y,0); */ ans.push_back({0,y,n/y}); ans.push_back({n/y,0,y}); ans.push_back({y,n/y,0}); } } /* for(ll z = 1; z <= n; z++){ if(n % z == 0)ans.emplace_back(n/z,0,z); } for(ll x = 1; x <= n; x++){ if(n % x == 0)ans.emplace_back(x,n/x,0); } */ cout << ans.size() << endl; rep(i,0,ans.size()){ cout << ans[i][0] << " " << ans[i][1] << " " << ans[i][2] << "\n"; /* ll x; ll y; ll z; tie(x,y,z) = ans[i]; cout << x << " " << y << " " << z << "\n"; */ } }