#include<stdio.h>
#include<math.h>

#define PI 3.141592653

void funk(int,double,double,double,double);

int main() {
  int x;
  scanf("%d",&x);

  printf("%f %f\n",0.0,0.0);
  funk(x,0.0,0.0,100.0,0.0);
  printf("%f %f\n",100.0,0.0);

  return 0;
}

void funk(int n,double x1,double y1,double x2,double y2) {
  double sx,sy,tx,ty,ux,uy;
   
  if(!n) {
    return;
  }

  sx = (2 * x1 + x2) / 3;
  sy = (2 * y1 + y2) / 3;
  tx = (x1 + 2 * x2) / 3;
  ty = (y1 + 2 * y2) / 3;
  ux = (tx - sx) * cos(PI / 3) - (ty - sy) * sin(PI / 3) + sx;
  uy = (tx - sx) * sin(PI / 3) + (ty - sy) * cos(PI / 3) + sy;

  funk(n - 1,x1,y1,sx,sy);
  printf("%f %f\n",sx,sy);
  funk(n - 1,sx,sy,ux,uy);
  printf("%f %f\n",ux,uy);
  funk(n - 1,ux,uy,tx,ty);
  printf("%f %f\n",tx,ty);
  funk(n - 1,tx,ty,x2,y2);
}
  

  

 

  

