import scala.io.StdIn.readInt
import scala.collection.mutable.ArrayBuffer

object Main {
  val c = Math.cos(Math.PI/3)
  val s = Math.sin(Math.PI/3)

  def getPoints(list:Array[(Double,Double)],i:Int):Array[(Double,Double)]  =
    if(i==0) list
    else {
      val b = new ArrayBuffer[(Double,Double)]
      for( k<-0 until list.length-1) {
        val i = list(k); val j = list(k+1)
        val p1 = ((i._1*2+j._1)/3,(i._2*2+j._2)/3)
        val p2 = ((i._1+j._1*2)/3,(i._2+j._2*2)/3)
        val (dx,dy) = (p2._1-p1._1,p2._2-p1._2)
        if(k==0) b+=i
        b+=(p1,(dx*c-dy*s+p1._1,dx*s+dy*c+p1._2),p2,j)
      }
      getPoints(b.toArray,i-1)
    }

  def main(args:Array[String]) = {
    val n = readInt
    val list = getPoints(Array((0D,0D),(100D,0D)),n)
    println(list.map(s=>s._1+" "+s._2).mkString("\n"))
  }
}