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

int n;

void kock(double lpx, double lpy, double rpx, double rpy, int n){
	if(n==0)return;
	double sx, sy, tx, ty, ux, uy;
	double ag = M_PI/180;
	
	sx = (2*lpx + rpx)/3, sy = (2*lpy + rpy)/3;
	tx = (lpx + 2*rpx)/3, ty = (lpy + 2*rpy)/3;
	ux = (tx-sx)*cos(60*ag) - (ty-sy)*sin(60*ag) + sx;
	uy = (tx-sx)*sin(60*ag) + (ty-sy)*cos(60*ag) + sy;
	
	kock(lpx, lpy, sx, sy, n-1);
	printf("%f %f\n", sx, sy);
	kock(sx, sy, ux, uy, n-1);
	printf("%f %f\n", ux, uy);
	kock(ux, uy, tx, ty, n-1);
	printf("%f %f\n", tx, ty);
	kock(tx, ty, rpx, rpy, n-1);
	
}

int main(){
	double p1x = 0, p1y = 0;
	double p2x = 100, p2y = 0;
	
	scanf("%d", &n);
	printf("%f %f\n", p1x, p1y);
	kock(p1x, p1y, p2x, p2y, n);
	printf("%f %f\n", p2x, p2y);
	
	return 0;
}
