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

#define PI 3.1415926535

int dim;
 
void Koch(double, double, double, double, int);
 
int main(){
  int i;
  double x1 = 0, y1 = 0, x2 = 100, y2 = 0;
   
  scanf("%d",&dim);
 
  printf("%1.8f %1.8f\n",x1,y1);
   
  if(0<=dim || dim<=6){
    Koch(x1,y1,x2,y2,dim);
  }
   
  printf("%1.8f %1.8f\n",x2,y2);
   
  return 0;
}
 
void Koch(double x1, double y1, double x2, double y2, int dim) {
  double x3=0, y3=0, x4=0, y4=0, x5=0, y5=0;
  double s , c;
   
  if(dim != 0){
    s = sin(PI/3);
    c = cos(PI/3);
 
    x3 = ( 2*x1 +   x2 ) / 3;
    y3 = ( 2*y1 +   y2 ) / 3;
    x5 = (   x1 + 2*x2 ) / 3;
    y5 = (   y1 + 2*y2 ) / 3;
    x4 = x3 + (x5-x3)*c + (y5-y3)*s;
    y4 = y3 - (x5-x3)*s + (y5-y3)*c;
    Koch( x1, y1, x3, y3, dim-1 );
    printf("%1.8f %1.8f\n",x3,fabs(y3));
    Koch( x3, y3, x4, y4, dim-1 );
    printf("%1.8f %1.8f\n",x4,fabs(y4));
    Koch( x4, y4, x5, y5, dim-1 );
    printf("%1.8f %1.8f\n",x5,fabs(y5));
    Koch( x5, y5, x2, y2, dim-1 );
}
  return;
}