#include <stdio.h>

typedef struct __xy {
	double x;
	double y;
} XY, *PXY;

double root(double d, int q);
void printXY(XY p);
XY addXY(XY p1, XY p2);
XY subXY(XY p1, XY p2);
XY mulXY(XY p, double v);
void koch(XY p1, XY p2, int n);

double cos60, sin60, div1p3, div2p3;

int main(void) {
	XY p1 = { 0.0, 0.0 };
	XY p2 = { 100.0, 0.0 };
	int n;
	
	cos60 = 0.5;
	sin60 = root(3.0, 25) / 2.0;
	div1p3 = 1.0 / 3.0;
	div2p3 = 2.0 / 3.0;
	
	scanf("%d", &n);
	
	koch(p1, p2, n);
	printXY(p2);
	
	return 0;
}

void printXY(XY p) {
	printf("%10.8lf %10.8lf\n", p.x, p.y);
}

XY addXY(XY p1, XY p2) {
	XY r = p1;
	r.x += p2.x;
	r.y += p2.y;
	return r;
}

XY subXY(XY p1, XY p2) {
	XY r = p1;
	r.x -= p2.x;
	r.y -= p2.y;
	return r;
}

XY mulXY(XY p, double v) {
	XY r = p;
	r.x *= v;
	r.y *= v;
	return r;
}

double root(double d, int q) {
	double p1 = 0;
	double p2 = d;
	double m, p;
	
	do {
		m = ((p2 - p1) / 2.0) + p1;
		p = m * m;
		if (p > d) {
			p2 = m;
		} else if (p < d) {
			p1 = m;
		} else {
			return m;
		}
		--q;
	} while (q > 0);
	
	return m;
}

void koch(XY p1, XY p2, int n) {
	XY df, p13, p23, t;
	if (n > 0) {
		--n;
		df = subXY(p2, p1);
		p13 = addXY(mulXY(df, div1p3), p1);
		p23 = addXY(mulXY(df, div2p3), p1);
		t.x = df.x * cos60 - df.y * sin60;
		t.y = df.x * sin60 + df.y * cos60;
		t = addXY(mulXY(t, div1p3), p13);
		koch(p1, p13, n);
		koch(p13,  t, n);
		koch(t,  p23, n);
		koch(p23, p2, n);
	} else {
		printXY(p1);
	}
}