import scala.io.StdIn.readInt
import scala.language.postfixOps

object Main {
  implicit class Add(p1:(Double,Double)) {
    def +(p2:(Double,Double)) = (p1._1+p2._1,p1._2+p2._2)
    def /(p2:Double) = (p1._1/p2,p1._2/p2)
    def *(p2:Double) = (p1._1*p2,p1._2*p2)
  }

  val angle = Math.PI/3
  def main(args:Array[String]) = {
    val n = readInt
    var list = Iterator(((0D,0D),(100D,0D)))
    var last = (0D,0D)
    (1 to n).foreach { _=>
      list = for{
        i<-list;
        p1 = i._1*2/3+i._2/3
        p2 = i._1/3+i._2*2/3
        x = (p2._1-p1._1)*Math.cos(angle)-(p2._2-p1._2)*Math.sin(angle)+p1._1
        y = (p2._1-p1._1)*Math.sin(angle)+(p2._2-p1._2)*Math.cos(angle)+p1._2
        p3 = (x,y)
        j<-List((i._1,p1),(p1,p3),(p3,p2),(p2,i._2)) iterator
      } yield j
    }
    for(i<-list) {
      printf("%.8f %.8f\n",i._1._1,i._1._2)
      last = i._2
    }
    printf("%.8f %.8f\n",last._1,last._2)
  }
}