n = gets.to_i

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

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

def koch(n, a, b)
  if n == 0
    return
  end

  s, t, u = Array.new(3){Point.new}

  th = Math::PI * 60.0/180.0

  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0
  u.x = (t.x - s.x) * Math.cos(th) - (t.y - s.y) * Math.sin(th) + s.x
  u.y = (t.x - s.x) * Math.sin(th) + (t.y - s.y) * Math.cos(th) + s.y

  koch(n-1,a,s)
  puts s.ans
  koch(n-1,s ,u)
  puts u.ans
  koch(n-1, u, t)
  puts t.ans
  koch(n-1,t, b)
end

a, b = Array.new(2){Point.new}
a.x = 0
a.y = 0
b.x = 100
b.y = 0

puts a.ans
koch(n, a, b)
puts b.ans
