include Math

n = gets.to_i

Point = Struct.new(:x, :y)

def koch(n, a, b)
  return if n == 0
  th = PI * 60 /180
  
  s = Point.new
  t = Point.new
  u = Point.new
  
  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0
  u.x = s.x + (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th)
  u.y = s.y + (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th)
  
  koch(n-1, a, s)
  puts "#{s.x} #{s.y}"
  koch(n-1, s, u)
  puts "#{u.x} #{u.y}"
  koch(n-1, u, t)
  puts "#{t.x} #{t.y}"
  koch(n-1, t, b)
end

a = Point.new(0, 0)
b = Point.new(100, 0)

puts "#{a.x} #{a.y}"
koch(n, a, b)
puts "#{b.x} #{b.y}"
