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


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

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

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


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

 	printf( "%.8f %.8f\n", 0.0, 0.0 );
 	if( 0 < n ) {
    	KochCurve( n, 0.0, 0.0, 100.0, 0.0 );
    }
	printf( "%.8f %.8f\n", 100.0, 0.0 );
	   
    return 0;
}