include Math

class Point
  attr_accessor :x, :y
  def initialize(x = 0.0, y = 0.0)
    @x = x
    @y = y
  end

  def dump
    puts "%.8f %.8f" % [@x, @y]
  end
end

def koch_curve(n, p1, p2)
  return if n == 0
  
  s = Point.new
  s.x = (2 * p1.x + p2.x) / 3
  s.y = (2 * p1.y + p2.y) / 3
  t = Point.new
  t.x = (2 * p2.x + p1.x) / 3
  t.y = (2 * p2.y + p1.y) / 3
  u = Point.new
  u.x = (t.x - s.x) * cos(PI / 3) - (t.y - s.y) * sin(PI / 3) + s.x
  u.y = (t.x - s.x) * sin(PI / 3) + (t.y - s.y) * cos(PI / 3) + s.y
  
  koch_curve(n-1, p1, s)
  s.dump
  koch_curve(n-1, s, u)
  u.dump
  koch_curve(n-1, u, t)
  t.dump
  koch_curve(n-1, t, p2)
end

n = gets.to_i
p1 = Point.new
p2 = Point.new(100.0, 0.0)

p1.dump
koch_curve(n, p1, p2)
p2.dump