#include <stdio.h>
#include <math.h>
static double g_cos_pi_3, g_sin_pi_3;
static int g_flag = 1;

void koch_curve(double x1, double y1, double x2, double y2, int n) {
	double x, y, ax, ay, bx, by, cx, cy;

	if (!n) {
		if (g_flag) {
			printf("%.8lf %.8lf\n", x1, y1);
			g_flag = 0;
		}
		printf("%.8lf %.8lf\n", x2, y2);
		return;
	}
	x = (x2-x1) / 3.0;
	y = (y2-y1) / 3.0;
	ax = x1 + x;
	ay = y1 + y;
	bx = x*g_cos_pi_3 - y*g_sin_pi_3 + ax;
	by = x*g_sin_pi_3 + y*g_cos_pi_3 + ay;
	cx = x2 - x;
	cy = y2 - y;

	koch_curve(x1, y1, ax, ay, n-1);
	koch_curve(ax, ay, bx, by, n-1);
	koch_curve(bx, by, cx, cy, n-1);
	koch_curve(cx, cy, x2, y2, n-1);
}

int main(void) {
	int n;

	g_cos_pi_3 = cos(M_PI / 3.0);
	g_sin_pi_3 = sin(M_PI / 3.0);
	scanf("%d", &n);
	koch_curve(0.0, 0.0, 100.0, 0.0, n);
	return 0;
}