# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_C&lang=jp
# ruby??§1/2???????????§0??????????????????????????¨??????????????????????????§???
# ?????¢??????????¨???????????????????????????????????????????????????£??????

include Math
require 'matrix'

def fractal(x1,y1,x2,y2)
	third = one_third(x1,y1,x2,y2)
	s = [x1+third[0],y1+third[1]]
	t = [x1+third[0]*2,y1+third[1]*2]
	vector = (Matrix[[(1/2).to_f,-sqrt(3)/2],[sqrt(3)/2,(1/2).to_f]]*Matrix[[third[0]],[third[1]]]).to_a
	u = [s[0]+vector[0][0],s[1]+vector[1][0]]
	return s,u,t,[x2,y2]
end

def one_third(x1,y1,x2,y2)
	return [(x2-x1)/3,(y2-y1)/3]
	#return (sqrt((x1-x2)**2+(y1-y2)**2))/3
end

n = gets.chomp.to_i
arrays = [[0,0],[100,0]]
n.times do 
	array1 = arrays[0]
	new_arrays = [[0,0]]
	arrays[1..(arrays.length-1)].each do |array2|
		new_array = fractal(array1[0],array1[1],array2[0],array2[1])
		new_array.each do |a|
			new_arrays.push(a)
		end
		array1 = array2
	end
	arrays = new_arrays
end
arrays.each do |array|
	puts array[0].to_s+' '+array[1].to_s
end