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

typedef struct{
  double xcordi;
  double ycordi;
}Koch;

Koch Start,Finish;

void MakeCurve(int ,Koch ,Koch);

int main(){
  int depth=0;
  
  Start.xcordi=0;
  Start.ycordi=0;

  Finish.xcordi=100;
  Finish.ycordi=0;

  scanf("%d",&depth);

  printf("%0.8f %0.8f\n",Start.xcordi,Start.ycordi);

  MakeCurve(depth,Start,Finish);

  printf("%0.8f %0.8f\n",Finish.xcordi,Finish.ycordi);
  
  return 0;
}

void MakeCurve(int depth,Koch Start,Koch Finish){
  Koch Init,Med,End;
  
  if(depth==0){
    return;
  }

  Init.xcordi=(Start.xcordi*2+Finish.xcordi*1)/3;
  Init.ycordi=(Start.ycordi*2+Finish.ycordi*1)/3;

  Med.xcordi=(Start.xcordi*1+Finish.xcordi*2)/3;
  Med.ycordi=(Start.ycordi*1+Finish.ycordi*2)/3;

  End.xcordi=cos(M_PI/3)*(Med.xcordi-Init.xcordi)-sin(M_PI/3)*(Med.ycordi-Init.ycordi)+Init.xcordi;
  End.ycordi=sin(M_PI/3)*(Med.xcordi-Init.xcordi)+cos(M_PI/3)*(Med.ycordi-Init.ycordi)+Init.ycordi;
  
  MakeCurve(depth-1,Start,Init);

  printf("%0.8f %0.8f\n",Init.xcordi,Init.ycordi);

  MakeCurve(depth-1,Init,End);
  
  printf("%0.8f %0.8f\n",End.xcordi,End.ycordi);

  MakeCurve(depth-1,End,Med);

  printf("%0.8f %0.8f\n",Med.xcordi,Med.ycordi);

  MakeCurve(depth-1,Med,Finish);
  
}

