#include <stdio.h>
#include <stdlib.h>
#include <math.h>    
void kock(int,double,double,double,double);

int main()
{
  int n;
  double ret;
  double p1x = 0;
  double p1y = 0;
  double p2x = 100;
  double p2y = 0;
  scanf("%d",&n);
  printf("%.8f %.8f\n",p1x,p1y);
  kock(n,p1x,p1y,p2x,p2y);
  printf("%.8f %.8f\n",p2x,p2y);
  
  
  return 0;
}

void kock(int n,double p1x,double p1y,double p2x,double p2y){
  double sx,sy,tx,ty,ux,uy;
  double rad = sqrt(3.0);
  if(n==0) return;
  
  else{
    sx =(2*p1x + 1*p2x)/3;
    sy =(2*p1y + 1*p2y)/3;
    tx =(1*p1x + 2*p2x)/3;
    ty =(1*p1y + 2*p2y)/3;
    //    ux =(tx-sx)*cos(rad) - (ty-sy)*sin(rad)+sx;
    //    ux =(tx-sx)*sin(rad) + (ty-sy)*cos(rad)+sy;
    ux = sx + (-sx + rad*sy + tx - rad*ty)/2.0;
    uy = sy + (-rad*sx - sy + rad*tx + ty)/2.0;
 
    kock(n-1, p1x,p1y,sx,sy);
    printf("%.8f %.8f\n",sx,sy);
    kock(n-1, sx,sy,ux,uy);
    printf("%.8f %.8f\n",ux,uy);
    kock(n-1, ux,uy,tx,ty);
    printf("%.8f %.8f\n",tx,ty);
    kock(n-1, tx,ty,p2x,p2y);
    
  }
  
  
}