n = STDIN.gets.chomp.to_i

points = [[0.0, 0.0], [100.0, 0.0]]

n.times do |i|
  tmp_points = [points[0]]
  (1..(points.size-1)).each do |j|
    p1, p5 = points[j-1], points[j]
    p2 = [(2.0 * p1[0] + p5[0]) / 3.0, (2.0 * p1[1] + p5[1]) / 3.0]
    p4 = [(p1[0] + 2.0 * p5[0]) / 3.0, (p1[1] + 2.0 * p5[1]) / 3.0]
    base_r = Math.atan2(p5[1] - p1[1], p5[0] - p1[0]) * 180.0 / Math::PI
    p3_rad = ((base_r + 60) % 360) / 180.0 * Math::PI
    p3_distance = ((p2[0] - p1[0]) ** 2 + (p2[1] - p2[1]) ** 2) ** 0.5
    p3 = [
      p2[0] + Math.cos(p3_rad) * p3_distance,
      p2[1] + Math.sin(p3_rad) * p3_distance,
    ]
    tmp_points.push(p2, p3, p4, p5)
  end
  points = tmp_points
end

points.each do |p|
  puts "%.6f %.6f" % p
end