n = gets.chomp.to_i
TH = Math::PI * 60.0 / 180.0

class Point
  attr_accessor :x, :y

  def initialize(x = 0.0, y = 0.0)
    @x = x.to_f
    @y = y.to_f
  end

  def one_third(p1, p2)
    self.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0
    self.y = (2.0 * p1.y + 1.0 * p2.y) / 3.0
    return self
  end

  def two_third(p1, p2)
    self.x = (1.0 * p1.x + 2.0 * p2.x) / 3.0
    self.y = (1.0 * p1.y + 2.0 * p2.y) / 3.0
    return self
  end

  def apex(p1, p2)
    self.x = (p2.x - p1.x) * Math.cos(TH) - (p2.y - p1.y) * Math.sin(TH) + p1.x
    self.y = (p2.x - p1.x) * Math.sin(TH) + (p2.y - p1.y) * Math.cos(TH) + p1.y
    return self
  end

  def inspect
    puts "#{x} #{y}"
  end
end

def koch(time, p1, p2)
  if time == 0
    return
  end

  n = time - 1

  s = Point.new.one_third(p1, p2)
  t = Point.new.two_third(p1, p2)
  u = Point.new.apex(s, t)

  koch(n, p1, s)
  s.inspect
  koch(n, s, u)
  u.inspect
  koch(n, u, t)
  t.inspect
  koch(n, t, p2)
end

a = Point.new(0, 0)
b = Point.new(100, 0)

a.inspect
koch(n, a, b)
b.inspect