class KochCurve
  def solve(n)
    ans = koch(Point.new(0.0, 0.0), Point.new(100.0, 0.0), n)
  end

  def koch(pl, pr, n)
    if n== 0
      [pl, pr]
    else
      p1 = Point.new(
        (2 * pl.x + pr.x) / 3,
        (2 * pl.y + pr.y) / 3
      )
      p2 = Point.new(
        (pl.x + 2 * pr.x) / 3,
        (pl.y + 2 * pr.y) / 3
      )
      p3 = Point.new(
        (pl.x + pr.x) / 2 - Math.sqrt(3) * (pr.y - pl.y) / 6,
        (pl.y + pr.y) / 2 + Math.sqrt(3) * (pr.x - pl.x) / 6
      )

      a1 = koch(pl, p1, n - 1)
      a2 = koch(p1, p3, n - 1)
      a3 = koch(p3, p2, n - 1)
      a4 = koch(p2, pr, n - 1)

      a1.pop
      a2.pop
      a3.pop
      a1 + a2 + a3 + a4
    end
  end
end

class Point
  attr_accessor :x, :y
  def initialize(x, y)
    @x = x
    @y = y
  end
  def to_s
    "#{@x} #{@y}"
  end
end

kc = KochCurve.new
ans = kc.solve(gets.to_i)
ans.each{ | a | puts "#{a}" }

