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

int kock(int n,double p1x,double p1y,double p2x,double p2y)
{
	double sx,sy,tx,ty,ux,uy;
	double cos60 = 0.5, sin60 = sqrt(3) / 2;

	if (n == 0) {
		return 0;
	}
	sx = (2 * p1x + p2x) / 3;
	sy = (2 * p1y + p2y) / 3;
	tx = (p1x + 2 * p2x) / 3;
	ty = (p1y + 2 * p2y) / 3;
	ux = (tx - sx) * cos60 - (ty - sy) * sin60 + sx;
	uy = (tx - sx) * sin60 + (ty - sy) * cos60 + sy;

	kock(n - 1,p1x,p1y,sx,sy);
	printf("%f %f\n",sx,sy);
	kock(n - 1,sx,sy,ux,uy);
	printf("%f %f\n",ux,uy);
	kock(n - 1,ux,uy,tx,ty);
	printf("%f %f\n",tx,ty);
	kock(n - 1,tx,ty,p2x,p2y);
}

int main()
{
	int n;
	double p1x = 0,p1y = 0,p2x = 100,p2y = 0;
	scanf("%d",&n);
	printf("%f %f\n",p1x,p1y);
	kock(n,p1x,p1y,p2x,p2y);
	printf("%f %f\n",p2x,p2y);

	return 0;
}