include Math
class Point
  def initialize(x, y)
    @x = x.to_f
    @y = y.to_f
  end
  def distance(p)
    dx = @x - p.x
    dy = @y - p.y
    sqrt(dx * dx + dy * dy).to_f
  end
  def getX()
    @x
  end
  def getY()
    @y
  end
  def internally_dividing_point(p,m,n)
    Point.new(((n*@x+m*p.x)/(m+n)).to_f,((n*@y+m*p.y)/(m+n)).to_f)
  end
  def getC(p)
    cx=(((p.x-@x)*Math.cos(Math::PI/3)-(p.y-@y)*Math.sin(Math::PI/3))+@x).to_f
    cy=(((p.x-@x)*Math.sin(Math::PI/3)+(p.y-@y)*Math.cos(Math::PI/3))+@y).to_f
    Point.new(cx,cy)
  end
  protected
  attr_reader :x, :y
end
queue = Array.new()
queue.push(Point.new(0,0))
queue.push(Point.new(100,0))
queue.push(Point.new(0,0))
#p queue[0].internally_dividing_point(queue[1],1,2)
n = gets.chomp.to_i

n.times {|i|
 a,e = queue.shift,queue.shift
while e.getX() != 0
  
  b = a.internally_dividing_point(e,1,2)
  d = a.internally_dividing_point(e,2,1)
  c = b.getC(d)
  #p b,d,c
  queue.push(a) #first vertex
  queue.push(b)
  queue.push(c)
  queue.push(d)
  a,e = e,queue.shift
  if e.getX() == 0
    queue.push(a)
    queue.push(Point.new(0,0))
  end
end
}
queue.pop

#p queue[0].getX()
(queue.size).times {|i| 
  printf("%f %f\n",(queue[i].getX()),(queue[i].getY()))
}