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

void koch(double x1, double y1, double x2, double y2, int n){
  double sx,sy,ux,uy,tx,ty;
  if(n != 0){
    
    sx = (x2 - x1)/3 + x1;
    sy = (y2 - y1)/3 + y1;
    
    tx = 2 * (x2 - x1) / 3 + x1;
    ty = 2 * (y2 - y1) / 3 + y1;
    
    ux = (cos(M_PI/3)*(tx - sx) - sin(M_PI/3)*(ty-sy)) + sx;
    uy = (sin(M_PI/3)*(tx - sx) + cos(M_PI/3)*(ty-sy)) + sy;
    
    koch(x1,y1,sx,sy,n-1);
    koch(sx,sy,ux,uy,n-1);
    koch(ux,uy,tx,ty,n-1);
    koch(tx,ty,x2,y2,n-1);
  }else {
    printf("%f %f\n",x2,y2);
  }
}

int main(){
  int n;
  double x1 = 0.0,y1 = 0.0;
  double x2 = 100.0,y2 = 0.0;

  scanf("%d",&n);
  printf("%f %f\n",x1,y1);
  koch(x1,y1,x2,y2,n);
  return 0;
}