fun main(args: Array<String>) {
    val L = nextInt()
    var l = L
    var dl = 0
    var ce = 0
    val f = BooleanArray(20)
    val str = StringBuilder()
    while (l > 0) {
        if (l and 1 != 0) {
            f[dl] = true
            ce += 1
        }
        l /= 2
        dl += 1
    }
    str.append("${dl} ${(dl - 1) * 2 + ce - 1}\n")
    l = L
    var t = 1
    for (n in 1 until dl) {
        str.append("${n} ${n + 1} ${0}\n")
        str.append("${n} ${n + 1} ${t}\n")
        if (f[n - 1]) {
            str.append("${n} ${dl} ${l - t}\n")
            l -= t
        }
        t *= 2
    }
    print(str.toString())
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
