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


void KochCurve(double x1, double y1, double x2, double y2, int dim);
main(){
  int n;
  double M =100.0, m = 0.0;

 scanf("%d", &n);

 KochCurve(0, 0, 100, 0, n);

 printf("%f %f\n", M, m);
 return 0;
}


void KochCurve(double x1, double y1, double x2, double y2, int dim)
{
  double x3, y3, x4, y4, x5, y5;
  double y;

double s = sin(M_PI/3); 
double c = cos(M_PI/3);


if( dim <= 0 ){
  //printf( x1, y1, x2, y2 );

  if(y1 < 0){y = -y1;
    printf("%f %f\n", x1, y);
  }
  else printf("%f %f\n", x1, y1);
return;
}
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;
KochCurve( x1, y1, x3, y3, dim-1 );
KochCurve( x3, y3, x4, y4, dim-1 );
KochCurve( x4, y4, x5, y5, dim-1 );
KochCurve( x5, y5, x2, y2, dim-1 );
}