class KochCurve
  def solve
    n = gets.chomp.to_i
    ans = koch(Point.new(0.0,0.0), Point.new(100.0,0.0), n)
    ans.map! do |x|
      x.to_s
    end
    return ans
  end
  def koch(pl, pr, n)
    if n == 0
      [pl, pr]
    else
      p1 = Point.new((2 * pl.x + pr.x) / 3.0, (2 * pl.y + pr.y) / 3.0)
      p2 = Point.new((pl.x + 2 * pr.x) / 3.0, (pl.y + 2 * pr.y) / 3.0)
      p3 = Point.new((pl.x + pr.x) / 2.0 - Math.sqrt(3) * (pr.y - pl.y) / 6.0 ,(pl.y + pr.y) / 2.0 + Math.sqrt(3) * (pr.x - pl.x) / 6.0)

      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=0, y=0)
    @x = x
    @y = y
  end
  def to_s
    return "#{@x} #{@y}"
  end
end
if $0 == __FILE__
  puts KochCurve.new.solve
end