Coord = Struct.new(:x, :y)
Start = Coord.new(0.0, 0.0)
End = Coord.new(100.0, 0.0)
def koch(n, st, en)
    arr=[]
    return arr << st if n==0
    dx = en.x - st.x
    dy = en.y - st.y
    root3 = 3**(1.0/2)
    s = Coord.new((st.x * 2 + en.x)/3, (st.y * 2 + en.y)/3)
    t = Coord.new(s.x + dx/3, s.y + dy/3)
    u = Coord.new(s.x + (dx - dy * root3)/6, s.y + (dx * root3 + dy)/6)
    arr.concat(koch(n-1, st, s))
    arr.concat(koch(n-1, s, u))
    arr.concat(koch(n-1, u, t))
    arr.concat(koch(n-1, t, en))
end
n = gets.to_i
a = koch(n, Start, End)
a << End
a.each {|e|
    print e.x, ' ', e.y, "\n"
}