require 'matrix'

sixty_degree = Math::PI/3
@rotate_mat = Matrix[
  [Math.cos(sixty_degree), -Math.sin(sixty_degree)],
  [Math.sin(sixty_degree),  Math.cos(sixty_degree)]
]

def init(arr)
  arr[0...-1]
end

def koch(d, a, b) # => [Vector]
  if d == 0
    return [a, b]
  else
    p = a + (b - a) / 3.0
    r = a + (b - a) * 2.0 / 3.0
    q = p + @rotate_mat * (r - p)

    init(koch(d-1, a, p)) + init(koch(d-1, p, q)) + init(koch(d-1, q, r)) + koch(d-1, r, b)
  end
end

n = $stdin.gets.strip.to_i

init_a = Vector[0.0, 0.0]
init_b = Vector[100.0, 0.0]
points = koch(n, init_a, init_b)

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

