#include <stdio.h>
#include <math.h>
int n;

void compute(int depth,double x1,double y1,double x2,double y2)
{
  double sin60 = sqrt(3.0)/2.0;
  double cos60 = 0.5;

  double sx = (x1+x1+x2)/3.0;
  double sy = (y1+y1+y2)/3.0;
  double tx = (x1+x2+x2)/3.0;
  double ty = (y1+y2+y2)/3.0;

  double vx = tx-sx;//vector no x zahyou
  double vy = ty-sy;//vector no y zahyou

//sx wo kiten to suru.
  // vx wo cos 60 de sinsyuku
  // vy wo sin 60 de sinsyuku
  double ux = sx + cos60*vx - sin60*vy;

//sy wo kiten to suru.
  // vx wo sin 60 de sinsyuku
  // vy wo cos 60 de sinsyuku
  double uy = sy + sin60*vx + cos60*vy;

  if(depth>= n) return;

  compute(depth +1,x1,y1,sx,sy);
  printf("%.8f %.8f\n",sx,sy);
 compute(depth +1,sx,sy,ux,uy);
  printf("%.8f %.8f\n",ux,uy);
  compute(depth+1,ux,uy,tx,ty);
  printf("%.8f %.8f\n",tx,ty);
  compute(depth+1,tx,ty,x2,y2);
}




int main(void)
{
  scanf("%d",&n);
  printf("%.8f %.8f\n",0.0,0.0);
  compute(0,0.0,0.0,100.0,0.0);
  printf("%.8f %.8f\n",100.0,0.0);
  return 0;
}