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

typedef struct { double x, y; } R;

void koch(int n, R a, R b) {
	if (n == 0) return;

	R i, j, k;
	double th = M_PI * 60.0 / 180.0;

	i.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
	i.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
	j.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
	j.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
	k.x = (j.x - i.x) * cos(th) - (j.y - i.y) * sin(th) + i.x;
	k.y = (j.x - i.x) * sin(th) - (j.y - i.y) * cos(th) + j.y;

	koch(n - 1, a, i);
	printf("%.8f %.8f\n", i.x, i.y);
	koch(n - 1, i, k);
	printf("%.8f %.8f\n", k.x, k.y);
	koch(n - 1, k, j);
	printf("%.8f %.8f\n", j.x, j.y);
	koch(n - 1, j, b);
}

int main() {

	R a, b;
	int n;

	scanf("%d", &n);
	a.x = 0;
	a.y = 0;
	b.x = 100;
	b.y = 0;

	printf("%.8f %.8f\n", a.x, a.y);
	koch(n, a, b);
	printf("%.8f %.8f\n", b.x, b.y);

	return 0;
}
