#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#define int long long
using namespace std;

signed main() {
  int L; cin >> L;
  vector<tuple<int, int, int> > G;

  for(int i = 1; i <= 18; ++i) {
    G.push_back(make_tuple(i, i + 1, 0));
    G.push_back(make_tuple(i, i + 1, (1 << (i - 1))));
  }

  int Z = L, sum = 0;
  for(int i = 19; i >= 1; --i) {
    while(Z >= (1 << (i - 1))) {
      G.push_back(make_tuple(i, 20, sum));
      sum += (1 << (i - 1));
      Z -= (1 << (i - 1));
    }
  }

  cout << 20 << " " << G.size() << endl;
  for(int i = 0; i < G.size(); ++i) {
    cout << get<0>(G[i]) << " " << get<1>(G[i]) << " " << get<2>(G[i]) << endl;
  }

  return 0;
}
