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

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

void printp(pnt *);
void koch(int, pnt *, pnt *);

int main(void)
{
	int n;
	pnt p1, p2;
	
	scanf("%d",&n);
	p1.x = 0;
	p1.y = 0;
	p2.x = 100;
	p2.y = 0;
	printp(&p1);
	koch(n, &p1, &p2);
	printp(&p2);
	
	return 0;
}

void printp(pnt *p)
{
	printf("%f %f\n", p->x, p->y);
}

void koch(int n, pnt *p1, pnt *p2)
{
	pnt s, t, u;
	
	if(n==0) return;
	
	s.x = (2*p1->x + p2->x) / 3;
	s.y = (2*p1->y + p2->y) / 3;
	t.x = (p1->x + 2*p2->x) / 3;
	t.y = (p1->y + 2*p2->y) / 3;
	u.x = ( (t.x - s.x) - (t.y - s.y)*sqrt(3) ) / 2 + s.x;
	u.y = ( (t.x - s.x)*sqrt(3) + (t.y - s.y) ) / 2 + s.y;
	
	koch(n-1, p1, &s);
	printp(&s);
	koch(n-1, &s, &u);
	printp(&u);
	koch(n-1, &u, &t);
	printp(&t);
	koch(n-1, &t, p2);
}