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

void koch(int n, double xx, double xy, double yx, double yy)
{
	if(n==0){
		return;
	}
	
	double sx, sy, tx, ty, ux, uy;
	
	sx=(2.0*xx+1.0*yx)/3.0;
	sy=(2.0*xy+1.0*yy)/3.0;
	tx=(1.0*xx+2.0*yx)/3.0;
	ty=(1.0*xy+2.0*yy)/3.0;
	ux=(tx-sx)*cos(M_PI/3) - (ty-sy)*sin(M_PI/3) + sx;
	uy=(tx-sx)*sin(M_PI/3) + (ty-sy)*cos(M_PI/3) + sy;
	
	koch(n-1, xx, xy, sx, sy);
	printf("%.8f %.8f\n", sx, sy);
	koch(n-1, sx, sy, ux, uy);
	printf("%.8f %.8f\n", ux, uy);
	koch(n-1, ux, uy, tx, ty);
	printf("%.8f %.8f\n", tx, ty);
	koch(n-1, tx, ty, yx, yy);
}
	

int main(void)
{
	int n;
	scanf("%d", &n);
	
	double ax=0.0;
	double ay=0.0;
	double bx=100.0;
	double by=0.0;
	
	printf("%.8f %.8f\n", ax, ay);
	
	koch(n, ax, ay, bx, by);
	
	printf("%.8f %.8f\n", bx, by);
	
	return 0;
	
}
