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


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

int main(void)
{
	int n;
	scanf("%d", &n);
	
	double p1[2] = {0.0, 0.0};
	double p2[2] = {100.0, 0.0};
	
	printf("%f %f\n", p1[0], p1[1]);
	kock(n, p1, p2);
	printf("%f %f\n", p2[0], p2[1]);
	
	return 0;
}
