def third_points(points)
  point_one = {x: (points[1][:x] + 2.0 * points[0][:x]) / 3.0, y: (points[1][:y] + 2.0 * points[0][:y]) / 3.0}
  point_two = {x: (points[0][:x] + 2.0 * points[1][:x]) / 3.0, y: (points[0][:y] + 2.0 * points[1][:y]) / 3.0}
  [point_one, point_two]
end

def triangle(points)
  x = points[0][:x] + (points[1][:x] - points[0][:x]) / 2.0 - (points[1][:y] - points[0][:y]) * Math.sqrt(3.0) / 2.0
  y = points[0][:y] + (points[1][:y] + points[0][:y]) / 2.0 + (points[1][:x] - points[0][:x]) * Math.sqrt(3.0) / 2.0
  {x: x, y: y}
end
def koch(points, n)
  return points if n == 0
  used_points = koch(points, n - 1)
  new_points = []
  used_points.each_cons(2){|two_points|
    thirds = third_points(two_points)
    try = triangle(thirds)
    new_points.push(two_points[0], thirds[0], try, thirds[1])
  }
  new_points.push(points[-1])
  new_points
end

n = gets.to_i
koch_points = koch([{x: 0.0, y: 0.0}, {x: 100.0, y: 0.0}], n)
koch_points.each do |point|
  puts("#{sprintf("%.8f", point[:x])} #{sprintf("%.8f", point[:y])}")
end