#include<stdio.h>
#include<math.h>
#define pi 3.141592

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

void kock(int n, point p1, point p2);

int main(void){
	
	int n;
	scanf("%d", &n);
	
	point p1, p2;
	
	p1.x=0.00000000, p1.y=0.00000000;
	p2.x=100.00000000, p2.y=0.00000000;
    
    printf("0.00000000 0.00000000\n");
	kock(n, p1, p2);
	printf("100.00000000 0.00000000\n");
	
	return 0;
}

void kock(int n, point p1, point p2){
	
	if(n==0) return;
	
	/*p1, p2 から s, t, u を計算*/
	point s, t, u;
	double rad=60*pi/180;
	
	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;
	
	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, s);
	printf("%lf %lf\n", s.x, s.y);
    kock(n-1, s, u);
    printf("%lf %lf\n", u.x, u.y);
    kock(n-1, u, t);
    printf("%lf %lf\n", t.x, t.y);
    kock(n-1, t, p2);
	
}
