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

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

void printpoint(point p){
	printf("%.8f %.8f\n",p.x,p.y);
}

void koch(int d,point p1,point p2){
	point s,u,t;
	double th = M_PI / 3.0;
	if(d==0)return;
	s.x = (p2.x + 2.0 * p1.x)/3.0;
	s.y = (p2.y + 2.0 * p1.y)/3.0;
	t.x = (2.0 * p2.x + p1.x)/3.0;
	t.y = (2.0 * p2.y + p1.y)/3.0;
	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);
	printpoint(s);
	koch(d-1,s,u);
	printpoint(u);
	koch(d-1,u,t);
	printpoint(t);
	koch(d-1,t,p2);
}

int main(void){
	int n;
	point ml,mr;
	ml.x = 0.0;
	ml.y = 0.0;
	mr.x = 100.0;
	mr.y = 0.0;
	scanf("%d",&n);
	printpoint(ml);
	koch(n,ml,mr);
	printpoint(mr);
	return 0;
}
