#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  ll l;
  cin>>l;
  if(l==2){
    cout<<"2 2"<<endl;
    cout<<"1 2 0"<<endl;
    cout<<"1 2 1"<<endl;
    return 0;
  }
  l--;
  vector<ll> bt;
  ll t=l;
  ll cnt=0;
  while(t){
    cnt+=t%2;
    bt.pb(t%2);
    t/=2;
  }

  ll n=bt.size();
  cout<<n<<" "<<(n-1)*2+cnt<<endl;
  ll k=pow(2,n-2);
  for(int i=0;i<n-1;i++){
    cout<<i+1<<" "<<i+2<<" "<<0<<endl;
    cout<<i+1<<" "<<i+2<<" "<<k<<endl;
    k/=2;
  }
  
  cout<<1<<" "<<n<<" "<<l<<endl;
  for(int i=0;i<bt.size()-1;i++){
    if(bt[i]==0)continue;
    l-=pow(2,i);
    cout<<1<<" "<<n-i<<" "<<l<<endl;
  }
  return 0;
}

