object Main extends App {
    type P = (Double, Double)
    def koch(p1: P, p2: P, n: Int): Unit = {
        if (n == 0) println(p1._1 + " " + p1._2)
        else {
            val s = ((p1._1*2+p2._1)/3, (p1._2*2+p2._2)/3)
            val t = ((p1._1+p2._1*2)/3, (p1._2+p2._2*2)/3)
            val x = math.Pi/3
            val (d1, d2) = (t._1-s._1, t._2-s._2)
            val u = (s._1+d1*math.cos(x)-d2*math.sin(x),s._2+d1*math.sin(x)+d2*math.cos(x))
            koch(p1, s, n-1)
            koch(s, u, n-1)
            koch(u, t, n-1)
            koch(t, p2, n-1)
        }
    }
    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)
}