#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
struct peak
{
	double r;
	double c;
};
void koch(int d,struct peak p1,struct peak p2)
{
	if(d==0)
		return;
	
	struct peak s,u,t;
	double th=60.0/180.0*3.14159265358979323;
	//计算s,u,t
	s.r=(2*p1.r+p2.r)/3;
	s.c=(2*p1.c+p2.c)/3;
	t.r=(p1.r+2*p2.r)/3;
	t.c=(p1.c+2*p2.c)/3;
	u.r=(t.r-s.r)*cos(th)-(t.c-s.c)*sin(th)+s.r;
	u.c=(t.r-s.r)*sin(th)+(t.c-s.c)*cos(th)+s.c;
	//绘制并输出
	koch(d-1,p1,s);
	printf("%.8f %.8f\n",s.r,s.c);
	koch(d-1,s,u);
	printf("%.8f %.8f\n",u.r,u.c);
	koch(d-1,u,t);
	printf("%.8f %.8f\n",t.r,t.c);
	koch(d-1,t,p2);
	return;
}
int main()
{
	int n;
	scanf("%d",&n);
	struct peak a,b;
	a.r=0;
	a.c=0;
	b.r=100;
	b.c=0;
	printf("%.8f %.8f\n",a.r,a.c);
	koch(n,a,b);
	printf("%.8f %.8f\n",b.r,b.c);
	return 0;
}
