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

typedef struct point_1
{
	double x,y;
} point;

void koch(int n,point r,point w)
{
	point s, t, u;

	if (n == 0){return;}


	double z= M_PI * 60.00 / 180.00;
	s.x = (2.0 * r.x + 1.0 * w.x) / 3.0;
	s.y = (2.0 * r.y + 1.0 * w.y) / 3.0;
	t.x = (1.0 * r.x + 2.0 * w.x) / 3.0;
	t.y = (1.0 * r.y + 2.0 * w.y) / 3.0;
	u.x = (t.x - s.x) * cos(z) - (t.y - s.y) * sin(z) + s.x;
	u.y = (t.x - s.x) * sin(z) + (t.y - s.y) * cos(z) + s.y;

	koch(n - 1, r, s);

	printf("%.8f %.8f\n", s.x, s.y);
	koch(n - 1, s, u);

	printf("%.8f %.8f\n", u.x, u.y);
	koch(n - 1, u, t);
	
	printf("%.8f %.8f\n", t.x, t.y);
	koch(n - 1, t, w);

}

int main(int argc, char** argv)
{
	point r,w;
	int n;

	scanf("%d", &n);

	r.x = 0, r.y = 0;
	w.x = 100, w.y = 0;

	printf("%.8f %.8f\n", r.x, r.y);
	koch(n, r, w);
	printf("%.8f %.8f\n", w.x, w.y);


	return 0;
}

