#include using namespace std; using ll = long long; vector> ans; __int128_t power(ll x, int e){ __int128_t t = 1; for (int i = 0; i < e; i++) t *= x; return t; } void solve(ll n, int e) { ll l = 1, r = 1; __int128_t t = 1; while (power(r, e) <= n){ if (t == n){ ans.push_back({e, l, r}); } if (t <= n) { r++; t += power(r, e); } else { t -= power(l, e); l++; } } return; } __int128_t square_sum(ll x){ return x * (x + 1) * (2 * x + 1) / 6; } void solve2(ll n) { for (ll w = 1; w * w * w <= 3 * n; w++){ auto check = [&](ll mid)->bool { return square_sum(mid + w - 1) - square_sum(mid - 1) <= n; }; ll ok = 0, ng = 1<<30; if (square_sum(ok + w - 1) - square_sum(ok - 1) > n) continue; while (abs(ok - ng) > 1){ ll mid = (ok + ng) / 2; if (check(mid)) ok = mid; else ng = mid; } if (square_sum(ok + w - 1) - square_sum(ok - 1) == n) ans.push_back({2, ok, ok + w - 1}); } } int main(){ ll n; cin >> n; assert(1 <= n && n <= 1000000000000000000); solve2(n); for (int i = 3; i < 60; i++){ solve(n, i); } sort(ans.begin(), ans.end()); cout << ans.size() << "\n"; for (auto [e, l, r] : ans){ cout << e << " " << l << " " << r << '\n'; } }