class Koch
  DEG = (60 * Math::PI / 180.0)

  def initialize
  end

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

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


  def solve(d, p1, p2)
    return if d==0

    s = Point.new
    s.x = (2*p1.x + p2.x) / 3.0;
    s.y = (2*p1.y + p2.y) / 3.0;

    t = Point.new
    t.x = (p1.x + 2*p2.x) / 3.0;
    t.y = (p1.y + 2*p2.y) / 3.0;

    u = Point.new
    u.x = (t.x - s.x)*Math.cos(DEG) - (t.y - s.y)*Math.sin(DEG) + s.x
    u.y = (t.y - s.y)*Math.sin(DEG) + (t.y - s.y)*Math.cos(DEG) + s.y

    solve(d-1, p1, s)
    s.dump
    solve(d-1, s, u)
    u.dump
    solve(d-1, u, t)
    t.dump
    solve(d-1, t, p2)
  end
end

d = gets.to_i
kh = Koch.new
p1 = Koch::Point.new(0.0, 0.0)
p2 = Koch::Point.new(100.0, 0.0)
p1.dump
kh.solve(d, p1, p2)
p2.dump