import scala.io.StdIn.readInt

case class Point(x: Double, y: Double)

object Main extends App {

  val n = readInt()

  val ps = solve(n, Point(0, 0), Point(100, 0))

  val results = ps.map {
    case Point(x, y) => f"$x%.8f $y%.8f"
  }

  results.foreach(println)

  def solve(n: Int, start: Point, end: Point): Iterator[Point] = {
    val th  = math.Pi / 3.0
    val cos = math.cos(th)
    val sin = math.sin(th)

    def koch(depth: Int, p1: Point, p2: Point, zs: List[Point]): List[Point] = {
      if (depth <= 0) zs
      else {
        val s = Point((2.0 * p1.x + p2.x) / 3.0, (2.0 * p1.y + p2.y) / 3.0)
        val t = Point((p1.x + 2.0 * p2.x) / 3.0, (p1.y + 2.0 * p2.y) / 3.0)
        val u = Point(
          (t.x - s.x) * cos - (t.y - s.y) * sin + s.x,
          (t.x - s.x) * sin + (t.y - s.y) * cos + s.y
        )

        val d     = depth - 1
        val list1 = s :: koch(d, p1, s, zs)
        val list2 = u :: koch(d, s, u, list1)
        val list3 = t :: koch(d, u, t, list2)
        koch(d, t, p2, list3)
      }
    }

    val xs = end :: koch(n, start, end, List(start))
    xs.reverseIterator
  }
}

