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

#define PI 3.141592653589793

int kock(int n,double p1_x,double p1_y,double p2_x,double p2_y){
	if(n==0){return 1;}
	double s_x,s_y;
	double t_x,t_y;
	double u_x,u_y;
	double rad_60=((60.0*PI)/180);

	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)*cos(rad_60))-((t_y-s_y)*sin(rad_60))+s_x);
	u_y = (((t_x-s_x)*sin(rad_60))+((t_y-s_y)*cos(rad_60))+s_y);

	kock(n-1,p1_x,p1_y,s_x,s_y);
	printf("%f %f\n",s_x,s_y);
	kock(n-1,s_x,s_y,u_x,u_y);
	printf("%f %f\n",u_x,u_y);
	kock(n-1,u_x,u_y,t_x,t_y);
	printf("%f %f\n",t_x,t_y);
	kock(n-1,t_x,t_y,p2_x,p2_y);
}

int calc(int N){
	double p1_x=0.0;
	double p1_y=0.0;
	double p2_x=100.0;
	double p2_y=0.0;

	printf("%f %f\n",p1_x,p1_y);	
	kock(N,p1_x,p1_y,p2_x,p2_y);
	printf("%f %f\n",p2_x,p2_y);

	return 1;
}

int main(){
	int N;

	scanf("%d",&N);
	
	calc(N);

	return 0;
}
