#include #include #include #include using namespace std; typedef long long ll; int main(){ ll N; cin >> N; vector> vec(0); for (ll i = 0; i <= 500; i++){ for (ll j = i; j <= 10000; j++){ if (i == 0 && j == 0) continue; if (N - i * j > 0){ if ((N - i * j) % (i + j) == 0){ ll k = (N - i * j) / (i + j); if (j <= k){ vec.push_back(tuple(i, j, k)); } } } } } vector> ans(0); for (ll i = 0; i < vec.size(); i++){ vector subvec(3); subvec[0] = get<0>(vec[i]); subvec[1] = get<1>(vec[i]); subvec[2] = get<2>(vec[i]); do{ ans.push_back(tuple(subvec[0], subvec[1], subvec[2])); }while(next_permutation(subvec.begin(), subvec.end())); } sort(ans.begin(), ans.end()); ll len = ans.size(); cout << len << endl; for (ll i = 0; i < len; i++){ cout << get<0>(ans[i]) << " " << get<1>(ans[i]) << " " << get<2>(ans[i]) << endl; } }