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

typedef struct xy
{
	double x;
	double y;
}XY;

void cohho(int n, XY head, XY tail)
{
	if(n == 0) return;

	double th = M_PI * 60.0 / 180.0;

	XY s, t, u;
	s.x = (2.0*head.x + tail.x) / 3.0;
	s.y = (2.0*head.y + tail.y) / 3.0;
	t.x = (head.x + 2.0*tail.x) / 3.0;
	t.y = (head.y + 2.0*tail.y) / 3.0;
	u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
	u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

	cohho(n-1, head, u);
	printf("%.8f %.8f\n", s.x, s.y);
	cohho(n-1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	cohho(n-1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	cohho(n-1, t, tail);
}
	

int main()
{
	int n;
	XY head, tail;
	head.x = 0; head.y = 0;
	tail.x = 100; tail.y = 0;

	scanf("%d", &n);

	printf("%.8f %.8f\n", head.x, head.y);
	cohho(n, head, tail);
	printf("%.8f %.8f\n", tail.x, tail.y);

	return 0;
}