#define _USE_MATH_DEFINES /*これがないと円周率M_PIが使えない*/
#include<stdio.h>
#include<math.h>

typedef struct {
	double x;
	double y;
} Point;

void koch(int d, Point p1, Point p2) {
	double th = M_PI * 60.0 / 180.0;

	if (d == 0) {
		return;
	}
	
	Point s = {0, 0}, t = { 0, 0 }, u = { 0, 0 };

	s.x = (2 * p1.x + 1 * p2.x) / 3;
	s.y = (2 * p1.y + 1 * p2.y) / 3;
	t.x = (1 * p1.x + 2 * p2.x) / 3;
	t.y = (1 * p1.y + 2 * p2.y) / 3;
	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;

	koch(d - 1, p1, s);
	printf("%f %f\n", s.x, s.y);
	koch(d - 1, s, u);
	printf("%f %f\n", u.x, u.y);
	koch(d - 1, u, t);
	printf("%f %f\n", t.x, t.y);
	koch(d - 1, t, p2);

}

int main() {
	Point p1 = { 0,0 };
	Point p2 = { 100, 0 };
	int n;

	scanf("%d", &n);

	printf("%f %f\n", p1.x, p1.y);
	koch(n, p1, p2);
	printf("%f %f\n", p2.x, p2.y);
 
	return 0;
}
