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

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

void Koch(int , P, P);

int main(){
	int n;
	P s,t;

	scanf("%d",&n);

	s.x = 0;
	s.y = 0;
	t.x = 100;
	t.y = 0;

	printf("%.8f %.8f\n",s.x,s.y);
	Koch(n, s, t);
	printf("%.8f %.8f\n",t.x,t.y);

	return 0;
}



void Koch(int n,P p1,P p2){
	P s,t,u;

	if(n == 0)return;

	double rad = M_PI * 60.0 / 180.0;

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

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

