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

int koch(double,double,double,double,int);

int n;
 
int koch(double px1,double py1,double px3,double py3,int n){
  double px2=0,py2=0;
  double px=0,py=0,tx=0,ty=0;
     
     
  if(n==0){
    printf("%.8f %.8f\n",px3,py3);
    return 0;
  } 
  else {
 
    px=((px3-px1)/3)+px1;
    py=((py3-py1)/3)+py1;
    
    px2 = (px1+px3)/2 -sqrt(3.0)*(py3-py1)/6;
    py2 = (py1+py3)/2 +sqrt(3.0)*(px3-px1)/6;
    
    tx=((px1-px3)/3)+px3;
    ty=((py1-py3)/3)+py3;
    
    koch(px1,py1,px,py,n-1);
    koch(px,py,px2,py2,n-1);
    koch(px2,py2,tx,ty,n-1);
    koch(tx,ty,px3,py3,n-1);
  }
  return 0;
}

int main(void) {
  int n;
  double x1=0,x3=100;
  double y1=0,y3=0;
     
  scanf("%d",&n);
  printf("%.8f %.8f\n",0.0,0.0);
  koch(x1,y1,x3,y3,n);
  return 0;
}