/*
 *	Argorithms and Data Structures
 *	Lectuire 5 
 *	Koch Curve
 */

#include <stdio.h>

#define Sin60 0.866025
#define Cos60 0.5

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

void TrisectionLine(Pos *s, Pos *t, Pos p1, Pos p2){
	s->x = ( 2.0*(p1.x) + (p2.x) ) / 3.0;
	s->y = ( 2.0*(p1.y) + (p2.y) ) / 3.0;

	t->x = ( (p1.x) + 2.0*(p2.x) ) / 3.0;
	t->y = ( (p1.y) + 2.0*(p2.y) ) / 3.0;
}

void CalcThirdPos(Pos *u, Pos s, Pos t){
	u->x = (t.x - s.x)*Cos60 - (t.y - s.y)*Sin60 + s.x;
	u->y = (t.x - s.x)*Sin60 + (t.y - s.y)*Cos60 + s.y;
}

void PutPos(Pos p){
	printf("%f %f\n", p.x, p.y);
}

void kock(int n, Pos p1, Pos p2){
	Pos s, t, u;
	
	if(n==0) return;

	TrisectionLine(&s, &t, p1, p2);
	CalcThirdPos(&u, s, t);

	kock(n-1, p1, s);	PutPos(s); 
	kock(n-1, s, u);	PutPos(u);
	kock(n-1, u, t);	PutPos(t);
	kock(n-1, t, p2);
}
	
int main(void){
	int n;
	Pos p1, p2;

	p1.x = 0.0;
	p1.y = 0.0;

	p2.x = 100.0;
	p2.y = 0.0;

	scanf("%d", &n);
	PutPos(p1);
	kock(n, p1, p2);
	PutPos(p2);
	return 0;	
}