object Main {
    import scala.language.implicitConversions
    import scala.language.reflectiveCalls
    type P = (Double, Double)
    implicit def toRichPoint(p: P) = new{ 
        def +(o: P) = (p._1 + o._1, p._2 + o._2)
        def -(o: P) = (p._1 - o._1, p._2 - o._2)
        def /(n: Double) = (p._1 / n, p._2 / n)
        def *(n: Double) = (p._1 * n, p._2 * n)
        val d = math.Pi/3
        def rot = (p._1 * math.cos(d) - p._2 * math.sin(d), p._1 * math.sin(d) + p._2 * math.cos(d))
    }
    def koch(p1: P, p2: P, n: Int): Unit = {
        if (n == 0) println(p1._1 + " " + p1._2)
        else {
            val s = (p2 - p1) / 3 + p1
            val t = (p2 - p1) * 2 / 3 + p1
            val u = s + (t - s).rot
            koch(p1, s, n-1)
            koch(s, u, n-1)
            koch(u, t, n-1)
            koch(t, p2, n-1)
        }
    }
    def main(args: Array[String]) = {
        val in = io.StdIn.readInt
        val p1 = (0.0, 0.0)
        val p2 = (100.0, 0.0)
        koch(p1, p2, in)
        println(p2._1 + " " + p2._2)
    }
}