import java.lang.Math.*

class position(x:Double,y:Double)
{
    public var x:Double = x
    public var y:Double = y
}
var n:Int = 0
var startP:position = position(0.0,0.0)
var endP:position=position(100.0,0.0)

fun main(args: Array<String>) {
    n = readLine()!!.toInt()
    println(startP.x.toString() + " " + startP.y.toString())
    koch(n,startP,endP)
    println(endP.x.toString() + " " + endP.y.toString())
}
private fun koch(d:Int,p1:position,p2:position)
{
    if (d==0) return
    var s:position = position(0.0,0.0)
    var t:position= position(0.0,0.0)
    var u:position= position(0.0,0.0)
    var th:Double = PI * 60.0 / 180.0

    s.x = (2 * p1.x+ p2.x) / 3
    s.y = (2 * p1.y + p2.y)/ 3
    t.x = (p1.x + 2 * p2.x) / 3
    t.y = (p1.y + 2 * p2.y) / 3
    u.x = (t.x- s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x
    u.y = (t.x- s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y
    koch(d-1,p1,s)
    println(s.x.toString() + " " + s.y.toString())
    koch(d-1,s,u)
    println(u.x.toString() + " " + u.y.toString())
    koch(d-1,u,t)
    println(t.x.toString() + " " + t.y.toString())
    koch(d-1,t,p2)
}
