Point = Struct.new(:x,:y)
def kochcurve(n,pl,pr)
  a = Array.new
  if n == 0
    a.push(pl)
    return a
  end
  vx = pr.x - pl.x
  vy = pr.y - pl.y
  wx = -vy / 6 * (3**(1.0/2.0))
  wy = vx / 6 * (3**(1.0/2.0))
  s = Point.new(pl.x+vx/3, pl.y+vy/3)
  t = Point.new(pl.x+vx/3*2, pl.y+vy/3*2)
  u = Point.new(pl.x+vx/2+wx, pl.y+vy/2+wy)
  a.concat(kochcurve(n-1,pl,s))
  a.concat(kochcurve(n-1,s,u))
  a.concat(kochcurve(n-1,u,t))
  a.concat(kochcurve(n-1,t,pr))
  a
end

n = gets.to_i
s = Point.new(0.0,0.0)
t = Point.new(100.0,0.0)
a = kochcurve(n,s,t)
a.push(t)
l = a.length
for i in 0...l
  printf("%.8f %.8f\n",a[i].x, a[i].y)
end