require 'matrix'

ROTATE_60 = Matrix[
  [1.0/2.0, -Math.sqrt(3)/2.0], 
  [Math.sqrt(3)/2.0, 1.0/2.0]
]

def rotate60(vec)
  ROTATE_60 * vec
end

def koch(vec1, vec2)
  vec1_2 = vec2 - vec1
  vec_p1 = vec1 + vec1_2 * (1.0/3.0)
  vec_p3 = vec1 + vec1_2 * (2.0/3.0)

  vec_p3_p1 = vec_p3 - vec_p1
  vec_p2 = vec_p1 + rotate60(vec_p3_p1)

  return [vec1, vec_p1, vec_p2, vec_p3, vec2]
end

n = gets.chomp.to_i
vec1 = Vector[0.0, 0.0]
vec2 = Vector[100.0, 0.0]
points = [vec1, vec2]

(n).times do 
  new_points = []
  points.each_with_index do |point, i|
    if (i >= 1) then
      new_points << koch(points[i-1], points[i])
    end
  end
  new_points.flatten!.uniq!
  points = new_points
end

points.each do |point|
  puts "#{point[0]} #{point[1]}"
end