#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define mymalloc(p,n) {p = malloc((n)*sizeof(*p));if ((p)==NULL) {printf("not enough memory?\n"); exit(1);};}

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


void setPoint(point *p,double x,double y){
	p->x=x;
	p->y=y;
}

void printPoint(point p){
	printf("%lf %lf\n",p.x,p.y);
}



point plus(point p,point q){
	point r;
	r.x=p.x+q.x;
	r.y=p.y+q.y;
	return r;
}

point scal(double a,point p){
	point r;
	r.x=a*p.x;
	r.y=a*p.y;
	return r;
}


point minus(point p){
	return scal(-1,p);
}


point calcU(point s,point t){
	point half,u,delta,delta2;
	half=scal(1/2.0,plus(s,t));
	delta=plus(t,minus(s));
	delta2.y=delta.x;
	delta2.x=-delta.y;
	delta2=scal(sqrt(3)/2.0,delta2);
	u=plus(half,delta2);
	return u;
}

void koch(point p1,point p2,int n){
	point s,u,t;
	if(n==0){
		printPoint(p1);
	}
	else{
		s=plus(p1,scal(1/3.0,plus(p2,minus(p1))));
		t=plus(p1,scal(2/3.0,plus(p2,minus(p1))));
		u=calcU(s,t);
		koch(p1,s,n-1);
		koch(s,u,n-1);
		koch(u,t,n-1);
		koch(t,p2,n-1);
	}
}

main(){
	int n;
	point p1,p2;
	setPoint(&p1,0,0);
	setPoint(&p2,100,0);
	scanf("%d",&n);
	koch(p1,p2,n);
	printPoint(p2);
	return 0;
}
	