#include <stdio.h>
#include <math.h>
#define PI 3.141592
typedef struct{
	double x;
	double y;
}XY;
XY S(XY, XY);
XY T(XY, XY);
XY U(XY, XY);
void kock(int,XY,XY);
XY S(XY p1,XY p2) {
	XY s;
	s.x = (2 * p1.x + p2.x) / 3;
	s.y = (2 * p1.y + p2.y) / 3;
	return s;
}
XY T(XY p1, XY p2) {
	XY t;
	t.x = (p1.x + 2 * p2.x) / 3;
	t.y = (p1.y + 2 * p2.y) / 3;
	return t;
}
XY U(XY t,XY s) {
	XY u;
	double rad = 60*PI/180.0;
	u.x = (t.x - s.x) * cos(rad) - (t.y - s.y) * sin(rad) + s.x;
	u.y = (t.x - s.x) * sin(rad) + (t.y - s.y) * cos(rad) + s.y;
	return u;
}
void kock(int n, XY p1, XY p2) {
	XY s, t, u;
	if (n == 0)	return;

	// p1, p2 から s, t, u を計算
	s = S(p1, p2);
	t = T(p1, p2);
	u = U(t, s);

	kock(n - 1, p1, s);
	printf("%lf %lf", s.x, s.y);
	printf("\n");
	kock(n - 1, s, u);
	printf("%lf %lf", u.x, u.y);
	printf("\n");
	kock(n - 1, u, t);
	printf("%lf %lf", t.x, t.y);
	printf("\n");
	kock(n - 1, t, p2);
}
int main(){
	XY p1 = {0,0}
	, p2 = {100.0};
	int n;
	scanf("%d",&n);
	printf("%lf %lf", p1.x, p1.y);
	printf("\n");
	kock(n,p1,p2);
	printf("%lf %lf", p2.x, p2.y);
	printf("\n"); 
return 0;
}
