include(Math)

n = gets.to_i

def koch(x0,y0, x1,y1, m)
  if m == 0
    [[x0,y0]]
  else
    # n = sqrt((y0-y1)**2+(x1-x0)**2)
    s = [(2*x0+x1)/3.0,(2*y0+y1)/3.0]
    t = [(x0+2*x1)/3.0,(y0+2*y1)/3.0]
    u = [(x0+x1)/2.0-3*sqrt(3)*(y1-y0),(y0+y1)/2.0+3*sqrt(3)*(x1-x0)]
    return koch(x0,y0, s[0],s[1], m-1) + koch(s[0],s[1], u[0],u[1], m-1) +
           koch(u[0],u[1], t[0],t[1], m-1) + koch(t[0],t[1], x1,y1, m-1)
  end
end

a = koch(0,0,100,0,n) + [[100.0,0.0]]

a.each do |e|
  print e[0].to_f, " ", e[1].to_f, "\n"
end