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

typedef struct{ 
double x,y;
}Point;

void kochcurve( int n , Point a , Point b ){
  if( n == 0 ){
    return; 
  }
  Point c,d,e;
  double th = M_PI * 60.0 / 180.0;

  c.x = ( 2.0 * a.x + 1.0 * b.x ) / 3.0;
  c.y = ( 2.0 * a.y + 1.0 * b.y ) / 3.0;
  d.x = ( 1.0 * a.x + 2.0 * b.x ) / 3.0;
  d.y = ( 1.0 * a.y + 2.0 * b.y ) / 3.0;
  e.x = ( d.x - c.x ) * cos( th ) - (d.y - c.y ) * sin( th ) + c.x;
  e.y = ( d.x - c.x ) * sin( th ) + (d.y - c.y ) * cos( th ) + c.y;

  kochcurve( n - 1 , a , c );
  printf("%.8f %.8f\n" , c.x , c.y );
  kochcurve( n - 1 , c , e );
  printf("%.8f %.8f\n" , e.x , e.y );
  kochcurve( n - 1 , e , d );
  printf("%.8f %.8f\n" , d.x , d.y );
  kochcurve( n - 1 , d , b );
}

int main ( void ){
  Point a,b;
  int n;
  scanf("%d" , &n );
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;
  printf("%.8f %.8f\n" , a.x , a.y );
  kochcurve( n , a , b );
  printf("%.8f %.8f\n" , b.x , b.y );
 
  return 0;
}