#include <cstdio>
int main(){
	int L,min=233,ans=0; scanf("%d",&L);
	for (int i=0;i<20;i++) if ((1<<i)&L) min=i,ans++;
	ans+=min*2; if (min==19) ans--;
	printf("20 %d\n",ans);
	for (int i=1;i<=min;i++) printf("%d %d %d\n%d %d %d\n",i,i+1,0,i,i+1,1<<i-1);
	int x=min==19?524288:0;
	for (int i=0;i<19;i++) if (1<<i&L) printf("%d %d %d\n",i+1,20,x),x+=1<<i;
}