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


void KochCurve( double n, double px, double py, double px2, double py2 )
{
	double side, a, h;
	double sx,sy,ux,uy,tx,ty;
	
	if( py == py2 ) {
		side=px2-px;
		side/=3;
		a=side/2;
		h=sqrt( side*side-a*a );	
		
		sx=px+side;
		ux=sx+a;
		tx=sx+side;
		
		sy=py;
		uy=py+h;
		ty=py2;
	} else if( py < py2 ) {
		side=px2-px;	
		side/=3;
		h=py2;	
			
		sx=px+side;
		ux=px;
		tx=sx+side;

		sy=h/3;
		ty=uy=sy*2;
	} else {
		side=px2-px;	
		side/=3;
		h=py;	
			
		sx=px+side;
		ux=px;
		tx=sx+side;

		ty=h/3;
		sy=uy=ty*2;	
	}

	if( 1 < n ) {
		KochCurve( n-1, px, py, sx, sy );
	}
	printf( "%f %f\n", sx, sy );//s
	if( 1 < n ) {
		KochCurve( n-1, sx, sy, ux, uy );
	}
	printf( "%f %f\n", ux, uy );//u
	if( 1 < n ) {
		KochCurve( n-1, ux, uy, tx, ty );
	}
	printf( "%f %f\n", tx, ty );//t
	if( 1 < n ) {
		KochCurve( n-1, tx, ty, px2, py2 );
	}

	if( 0 == n ) { 
		return;
	} 
}


int main( void ) 
{
	int n;
	
    scanf( "%d", &n );

 	printf( "%f %f\n", 0.0, 0.0 );
    KochCurve( n, 0.0, 0.0, 100.0, 0.0 );
	printf( "%f %f\n", 100.0, 0.0 );
	   
    return 0;
}