#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define scani(x) scanf("%d",&x)
#define scanc(x) scanf("%s",x)
#define printi(x) printf("%d",x)
#define printin(x) printf("%d\n",x)
#define printd(x) printf("%.8f",x)
#define printc(x) printf("%s",x)
#define repd(i,n,m) for(int i = n; i > m; i--)
#define repu(i,n,m) for(int i = n; i < m; i++)
#define allprintu(i,n,m,a) for(int i = n; i < m; i++){if(i != m-1){printf("%d ",a[i]);}else{printf("%d\n",a[i]);}}
#define allprintd(i,n,m,a) for(int i = n; i > m; i--){if(i != 0){printf("%d ",a[i]);}else{printf("%d\n",a[i]);}}


int x;
double pp1[2] = {0,0}, pp2[2] = {100,0};

void kock(int n, double p1[], double p2[]){
	if(n == 0){
		return;
	}
	double s[2] = {(2*p1[0]+1*p2[0])/3,
				(2*p1[1]+1*p2[1])/3};
	double t[2] = {(1*p1[0]+2*p2[0])/3,
				(1*p1[1]+2*p2[1])/3};
	double u[2] = {(t[0]-s[0])*cos(M_PI/3) - (t[1]-s[1])*sin(M_PI/3) + s[0],
				(t[0]-s[0])*sin(M_PI/3) + (t[1]-s[1])*cos(M_PI/3) + s[1] };
	kock(n-1,p1,s);
	repu(i,0,2){
		printd(s[i]);
		printf(" ");
	}
	printf("\n");

	kock(n-1,s,u);
	repu(i,0,2){
		printd(u[i]);
		printf(" ");
	}
	printf("\n");

	kock(n-1,u,t);
	repu(i,0,2){
		printd(t[i]);
		printf(" ");
	}
	printf("\n");
	kock(n-1,t,p2);
}
int main(void){
	scani(x);
	repu(i,0,2){
		printd(pp1[i]);
		printf(" ");
	}
	printf("\n");
	kock(x,pp1,pp2);
	repu(i,0,2){
		printd(pp2[i]);
		printf(" ");
	}
	printf("\n");

	return 0;
}
