#include<stdio.h>
#include<math.h>
#define pai 3.141592653

void koch(int n,double x1,double y1,double x2,double y2)
{
	if(!n) return;
	double sx,sy,tx,ty,ux,uy;
	
	sx = (x1 * 2 + x2)/3.0;
	sy = (y1 * 2 + y2)/3.0;
	tx = (x1 + x2 * 2)/3.0;
	ty = (y1 + y2 * 2)/3.0;
	
	ux = (tx-sx)*cos(pai/3)-(ty-sy)*sin(pai/3)+sx;
	uy = (tx-sx)*sin(pai/3)+(ty-sy)*cos(pai/3)+sy;
	
	koch(n-1,x1,y1,sx,sy);
	printf("%f %f\n",sx,sy);
	koch(n-1,sx,sy,ux,uy);
	printf("%f %f\n",ux,uy);
	koch(n-1,ux,uy,tx,ty);
	printf("%f %f\n",tx,ty);
	koch(n-1,tx,ty,x2,y2);
}

int main()
{
	int n;
	
	scanf("%d",&n);
	printf("%f %f\n",0.0,0.0);
	koch(n,0.0,0.0,100.0,0.0);
	printf("%f %f\n",100.0,0.0);
	return 0;
}

