import math._

case class Point(x: Double, y: Double) {
  override def toString = s"$x $y"
}

object KochCurve {
  val th = 60.0.toRadians

  def koch(n: Int, p1: Point, p2: Point): List[Point] = {
    require(n >= 0)

    def go(n: Int, p1: Point, p2: Point): List[Point] = {
      if (n == 0)
        List(p2)
      else {
        // わかんないのでコピペ
        val s = Point((2.0 * p1.x + 1.0 * p2.x) / 3.0,
			          (2.0 * p1.y + 1.0 * p2.y) / 3.0)
        val t = Point((1.0 * p1.x + 2.0 * p2.x) / 3.0,
			          (1.0 * p1.y + 2.0 * p2.y) / 3.0)
        val u = Point((t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x ,
			          (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y)
        go(n - 1, p1, s) ++
        go(n - 1, s,  u) ++
        go(n - 1, u,  t) ++
        go(n - 1, t,  p2)
      }
    }

    p1::go(n, p1, p2)
  }

  def run() = {
    val sc = new java.util.Scanner(Console.in)
    val n = sc.next().toInt
    println(koch(n, Point(0.0, 0.0), Point(100.0, 0.0)) mkString "\n")
  }
}

object Main extends App {
  KochCurve.run()
}

