package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func rot(x int, y int) (int, int) {
	return -y, x
}

type Edge struct {
	To   int
	Cost int
}

func main() {
	sc.Split(bufio.ScanWords)
	L, _ := strconv.Atoi(read())
	V := 1
	for ; (1 << uint(V)) <= L; V++ {
	}
	es := make([][]Edge, V)
	for i := 0; i < V; i++ {
		es[i] = make([]Edge, 0)
		es[i] = append(es[i], Edge{i + 1, 0}, Edge{i + 1, 1 << uint(i)})
	}
	for i := 0; i < V-1; i++ {
		if L&(1<<uint(i)) != 0 {
			tmp := (1 << 30) - 1
			tmp ^= (1 << uint(i+1)) - 1
			es[i] = append(es[i], Edge{V - 1, L & tmp})
		}
	}
	E := 0
	for _, e := range es {
		E += len(e)
	}
	fmt.Printf("%d %d\n", V, E)
	for i := 0; i < V; i++ {
		for _, e := range es[i] {
			fmt.Printf("%d %d %d\n", i+1, e.To+1, e.Cost)
		}
	}
}
