#include<stdio.h>
#include<math.h>
#define pi 3.14159265359

void koch(double p1x, double p1y, double p2x, double p2y, int n) {
	double sx, sy, ux, uy, tx, ty, lx, ly;
	
	if (p1x > p2x)
	{
		lx = p1x - p2x;
		tx = p2x + lx/3;
		sx = p2x + 2*lx/3;
		if (p1y > p2y)
		{
			ly = p1y - p2y;
			ty = p2y + ly/3;
			sy = p2y + 2*ly/3;
			ux = (sx - tx)*cos(pi/3) - (sy - ty)*sin(pi/3) + sx;
			uy = (sx - tx)*sin(pi/3) - (sy - ty)*cos(pi/3) + sy;
		}
		else
		{
			ly = p2y - p1y;
			sy = p1y + ly/3;
			ty = p1y + 2*ly/3;
			ux = (sx - tx)*cos(pi/3) - (ty - sy)*sin(pi/3) + sx;
			uy = (sx - tx)*sin(pi/3) - (ty - sy)*cos(pi/3) + sy;
		}
	}
	else
	{
		lx = p2x - p1x;
		sx = p1x + lx/3;
		tx = p1x + 2*lx/3;
		if (p1y > p2y)
		{
			ly = p1y - p2y;
			ty = p2y + ly/3;
			sy = p2y + 2*ly/3;
			ux = (tx - sx)*cos(pi/3) - (sy - ty)*sin(pi/3) + sx;
			uy = (tx - sx)*sin(pi/3) - (sy - ty)*cos(pi/3) + sy;
		}
		else
		{
			ly = p2y - p1y;
			sy = p1y + ly/3;
			ty = p1y + 2*ly/3;
			ux = (tx - sx)*cos(pi/3) - (ty - sy)*sin(pi/3) + sx;
			uy = (tx - sx)*sin(pi/3) - (ty - sy)*cos(pi/3) + sy;
		}
	}
	
	if (n > 0)
	{
		koch(p1x, p1y, sx, sy, n - 1);
		printf("%.8f %.8f\n", sx, sy);
		koch(sx, sy, ux, uy, n - 1);
		printf("%.8f %.8f\n", ux, uy);
		koch(ux, uy, tx, ty, n - 1);
		printf("%.8f %.8f\n", tx, ty);
		koch(tx, ty, p2x, p2y, n - 1);
	}
}

int main(void) {
	double p1x = 0, p1y = 0, p2x = 100, p2y = 0;
	int n;
	scanf("%d", &n);
	
	printf("%.8f %.8f\n", p1x, p1y);
	koch(p1x, p1y, p2x, p2y, n);
	printf("%.8f %.8f\n", p2x, p2y);
	
	return 0;
}