require 'matrix'

SIN60 = Math.sin(-60.0 / 180.0 * Math::PI)
COS60 = Math.cos(-60.0 / 180.0 * Math::PI)
ROTATE = Matrix[[COS60, SIN60], [-SIN60, COS60]]

def koch(n, st, ed)
  return [ed] if n == 0
  e = (ed - st) / 3
  s = st + e
  u = s + ROTATE * e
  t = s + e
  return [
    koch(n - 1, st, s),
    koch(n - 1, s, u),
    koch(n - 1, u, t),
    koch(n - 1, t, ed)
  ].flatten
end

puts "%.6f %.6f" % Vector[0.0, 0.0].to_a
koch(gets.to_i, Vector[0.0, 0.0], Vector[100.0, 0.0]).each do |p|
  puts "%.6f %.6f" %  p.to_a
end
