fun main(args: Array<String>) {
    data class Point(val x: Double, val y: Double) {
        override fun toString(): String {
            return "$x $y"
        }
    }

    fun koch(n: Int, p1: Point, p2: Point): List<Point> {
        if (n == 0) {
            return emptyList()
        }

        val s = Point((2 * p1.x + 1 * p2.x) / 3, (2 * p1.y + 1 * p2.y) / 3)
        val t = Point((1 * p1.x + 2 * p2.x) / 3, (1 * p1.y + 2 * p2.y) / 3)

        val th = Math.PI * 60 / 180

        val ux = (t.x - s.x) * Math.cos(th) - (t.y - s.y) * Math.sin(th) + s.x
        val uy = (t.x - s.x) * Math.sin(th) + (t.y - s.y) * Math.cos(th) + s.y

        val u = Point(ux, uy)

        val r = mutableListOf<Point>()

        r.addAll(koch(n - 1, p1, s))
        r.add(s)
        r.addAll(koch(n - 1, s, u))
        r.add(u)
        r.addAll(koch(n - 1, u, t))
        r.add(t)
        r.addAll(koch(n - 1, t, p2))

        return r
    }

    val n = readLine()!!.toInt()

    val p1 = Point(0.0, 0.0)
    val p2 = Point(100.0, 0.0)

    val ans = mutableListOf<Point>()
    ans.add(p1)
    ans.addAll(koch(n, p1, p2))
    ans.add(p2)

    ans.forEach { println(it) }
}
