def get_height(left, right)
  x = right[0] - left[0]
  y = right[1] - left[1]
  [left[0] + x / 2.0 - Math.sqrt(3) / 6.0 * y, y - y / 2.0 + Math.sqrt(3) / 6.0 * x]
end

def koch_curve_h(n, left, right, result)
  dots = []
  dots << left
  dots << [left[0] + (right[0] - left[0]) / 3.0, left[1] + (right[1] - left[1]) / 3.0]
  dots << get_height(left, right)
  dots << [left[0] + (right[0] - left[0]) * 2.0 / 3.0, left[1] + (right[1] - left[1]) * 2.0 / 3.0]
  dots << right
  if n == 1
    dots
  else
    (koch_curve_h(n-1, dots[0], dots[1], dots) + koch_curve_h(n-1, dots[1], dots[2], dots) +
    koch_curve_h(n-1, dots[2], dots[3], dots) + koch_curve_h(n-1, dots[3], dots[4], dots)).uniq
  end
end

def koch_curve(n, left, right)
  koch_curve_h(n, left, right, [])
end

n = gets.to_i


koch_curve(n, [0.0, 0.0], [100.0, 0.0]).each { |dot| puts dot.join(' ') }