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

void kock(int n, double x1,double  y1, double  x2,double y2){
  double sx,sy, tx,ty, ux,uy;
  if (n > 0){

  sx = (2 * x1 + 1 * x2) / 3 ;
  sy = (2 * y1 + 1 * y2) / 3 ;

  tx = (1 * x1 + 2 * x2) / 3 ;
  ty = (1 * y1 + 2 * y2) / 3 ;

  ux = ((tx - sx) * cos(M_PI / 3) - (ty - sy) * sin(M_PI / 3)) + sx;
  uy = ((tx - sx) * sin(M_PI / 3) + (ty - sy) * cos(M_PI / 3)) + sy;
  

  kock(n-1, x1,y1, sx,sy);
  printf("%f %f\n",sx,sy);
  kock(n-1, sx,sy, ux,uy);
  printf("%f %f\n",ux,uy);
  kock(n-1, ux,uy, tx,ty);
  printf("%f %f\n",tx,ty);
  kock(n-1, tx,ty, 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);
  kock(n, x1,y1, x2,y2);
  printf("%f %f\n",x2,y2);
  return 0;
}
  