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

#define rad 1.0471975511966 //60度のラジアン角

void kock(int n, double p1_x, double p1_y, double p2_x, double p2_y){
	
	if(n == 0){
		return;
	}
	double s_x, s_y, t_x, t_y, u_x, u_y;
	
	s_x = (2 * p1_x + 1 * p2_x) / 3;
	s_y = (2 * p1_y + 1 * p2_y) / 3; 
	
	t_x = (1 * p1_x + 2 * p2_x) / 3;
	t_y = (1 * p1_y + 2 * p2_y) / 3;
	
//	double rad = 60 * PI / 180.0;
	u_x = (t_x - s_x) * cos(rad) - (t_y - s_y) * sin(rad) + s_x;
	u_y = (t_x - s_x) * sin(rad) + (t_y - s_y) * cos(rad) + s_y;
	
	kock(n-1, p1_x, p1_y, s_x, s_y);
	printf("%lf %lf\n", s_x, s_y);
	
	kock(n-1, s_x, s_y, u_x, u_y);
	printf("%lf %lf\n", u_x, u_y);
	
	kock(n-1, u_x, u_y, t_x, t_y);
	printf("%lf %lf\n", t_x, t_y);
	
	kock(n-1, t_x, t_y, p2_x, p2_y);

}


int main() {
	int n;
	
	scanf("%d",&n);
	
	printf("%lf %lf\n",0.0,0.0);
	kock(n,0,0,100,0);
	printf("%lf %lf\n",100.0,0.0);
	
	
	return 0;
}




