def koch_curve(x1,y1,x5,y5)
	x2 = (2 * x1 + 1 * x5) / 3
	y2 = (2 * y1 + 1 * y5) / 3
	
	x4 = (x2 + x5) / 2
	y4 = (y2 + y5) / 2

	x3=(((x4-x2)*Math.cos(Math::PI/3)-(y4-y2)*Math.sin(Math::PI/3))+x2).to_f
    y3=(((x4-x2)*Math.sin(Math::PI/3)+(y4-y2)*Math.cos(Math::PI/3))+y2).to_f
	
	return [x2,x3,x4],[y2,y3,y4]
end

n = gets.chomp.to_i
px = Array.new
py = Array.new

px[0] = 0.0
py[0] = 0.0
px[1] = 100.0
py[1] = 0.0

n.times {
	line_num = px.length-1
	idx = 0
	line_num.times { |i|
		px[idx+1,0],py[idx+1,0] = koch_curve(px[idx],py[idx],px[idx+1],py[idx+1])
		idx += 4
	}
}

px.length.times { |i|
	puts px[i].to_s + " " + py[i].to_s
}