#include <bits/stdc++.h>
#define th(x) x/180*acos(-1)
using namespace std;
struct Point{
	double x,y;
};
int n;
void dfs(Point p1,Point p2,int cnt){
	if(cnt==n){
		printf("%.8lf %.8lf\n",p2.x,p2.y);
		return;
	}
	Point s,u,t;
	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;
	double th=60.0/180*acos(-1);
	u.x = (t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
	u.y = (t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
	dfs(p1,s,cnt+1);
	dfs(s,u,cnt+1);
	dfs(u,t,cnt+1);
	dfs(t,p2,cnt+1);
}
int main(){
	cin>>n;
	Point p1={0,0},p2={100,0};
	printf("%.8lf %.8lf\n",p1.x,p1.y);
	dfs(p1,p2,0);
}
