import ExtensionFunctions.testbit import java.io.BufferedReader import java.io.InputStreamReader import java.io.PrintWriter import java.util.* import kotlin.system.measureNanoTime typealias IPair = Pair typealias LPair = Pair typealias ILPair = Pair typealias List = MutableList typealias LList = List> typealias LLList = List> typealias LLLList = List> val writer: PrintWriter = PrintWriter(System.out, false) const val iinf: Int = 0x3fffffff const val inf: Long = 0x1fffffffffffffff const val eps: Double = 1e-9 const val mod: Int = 1000000007 fun solve() { val a = In.nextLong() val list = mutableListOf() for (i in 0 until 40) { list.add(IPair(i * 3, (i + 1) * 3)) list.add(IPair(i * 3 + 1, (i + 1) * 3)) list.add(IPair(i * 3, (i + 1) * 3 + 1)) list.add(IPair(i * 3 + 1, (i + 1) * 3 + 1)) list.add(IPair(i * 3 + 2, (i + 1) * 3 + 2)) if (a.testbit(i)) { list.add(IPair(i * 3, (i + 1) * 3 + 2)) } } list.add(IPair(-1, 0)) list.add(IPair(-1, 1)) println(list.size) for ((x, y) in list) { println(x + 2, y + 2) } } fun main() { System.err.printf("%.1f ms", measureNanoTime { solve() writer.flush() } / 1000000.0) } fun list(n1: Int, init: T): List = MutableList(n1) { init } fun list(n1: Int, n2: Int, init: T): LList = MutableList(n1) { list(n2, init) } fun list(n1: Int, n2: Int, n3: Int, init: T): LLList = MutableList(n1) { list(n2, n3, init) } fun list(n1: Int, n2: Int, n3: Int, n4: Int, init: T): LLLList = MutableList(n1) { list(n2, n3, n4, init) } fun list(n1: Int, init: (Int) -> T): List = MutableList(n1) { i1 -> init(i1) } fun list(n1: Int, n2: Int, init: (Int, Int) -> T): LList = MutableList(n1) { i1 -> MutableList(n2) { i2 -> init(i1, i2) } } fun list(n1: Int, n2: Int, n3: Int, init: (Int, Int, Int) -> T): LLList = MutableList(n1) { i1 -> MutableList(n2) { i2 -> MutableList(n3) { i3 -> init(i1, i2, i3) } } } fun list(n1: Int, n2: Int, n3: Int, n4: Int, init: (Int, Int, Int, Int) -> T): LLLList = MutableList(n1) { i1 -> MutableList(n2) { i2 -> MutableList(n3) { i3 -> MutableList(n4) { i4 -> init(i1, i2, i3, i4) } } } } fun > minmax(a: T, b: T) = if (a <= b) Pair(a, b) else Pair(b, a) fun min(vararg a: Int) = a.minOrNull()!! fun max(vararg a: Int) = a.maxOrNull()!! fun min(vararg a: Long) = a.minOrNull()!! fun max(vararg a: Long) = a.maxOrNull()!! fun > min(vararg a: T) = a.minOrNull()!! fun > max(vararg a: T) = a.maxOrNull()!! fun println(list: LList) = writer.println(list.joinToString("\n")) fun println(vararg args: Any?) = writer.println(args.joinToString(" ")) object ExtensionFunctions { fun String.toDigitArray() = map { it - '0' }.toMutableList() fun List.accumulate(): List { val s = MutableList(size + 1) { 0L } for ((i, v) in this.withIndex()) { s[i + 1] = s[i] + v } return s } fun Int.testbit(i: Int) = this shr i and 1 == 1 fun Long.testbit(i: Int) = this shr i and 1 == 1L fun Int.bitLength() = 32 - Integer.numberOfLeadingZeros(this) fun Long.bitLength() = 64 - java.lang.Long.numberOfLeadingZeros(this) fun Int.clamp(l: Int, r: Int) = coerceIn(l, r) fun Long.clamp(l: Long, r: Long) = coerceIn(l, r) operator fun String.times(n: Int) = repeat(n) fun Long.pow(p: Int): Long { var p = p var a = this var x = 1L while (p > 0) { if (p and 1 == 1) { x *= a } a *= a p = p shr 1 } return x } fun List.swap(i: Int, j: Int) { val temp = this[j] this[j] = this[i] this[i] = temp } fun List.runLengthEncoding(): List> { val encoded: List> = mutableListOf() var count = 1 for (i in 1..size) { if (i < size && this[i - 1] == this[i]) { count++ } else { encoded.add(this[i - 1] to count) count = 1 } } return encoded } } object In { private val reader = BufferedReader(InputStreamReader(System.`in`), 0x10000) private var tokenizer: StringTokenizer? = null fun next(): String { while (tokenizer?.hasMoreTokens() != true) { tokenizer = StringTokenizer(reader.readLine()) } return tokenizer!!.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextDouble() = next().toDouble() fun nextCharArray() = next().toCharArray().toMutableList() fun nextCharGrid(n: Int, m: Int) = MutableList(n) { nextCharArray() } fun nextStringArray(n: Int, op: (String) -> String = { it }) = MutableList(n) { op(next()) } fun nextIntArray(n: Int, op: (Int) -> Int = { it }) = MutableList(n) { op(nextInt()) } fun nextIntMatrix(h: Int, w: Int, op: (Int) -> Int = { it }) = MutableList(h) { nextIntArray(w, op) } fun nextLongArray(n: Int, op: (Long) -> Long = { it }) = MutableList(n) { op(nextLong()) } fun nextLongMatrix(h: Int, w: Int, op: (Long) -> Long = { it }) = MutableList(h) { nextLongArray(w, op) } fun nextGraph(n: Int, m: Int, directed: Boolean = false): List> { val res: LList = list(n, 0, 0) for (i in 0 until m) { val u = nextInt() - 1 val v = nextInt() - 1 res[u].add(v) if (!directed) { res[v].add(u) } } return res } }