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

#define PI 3.141592
int n;

void koch(int count,double lx,double ly,double rx,double ry){
	
	if(count == 0) return;
	
	double lx1 = lx + (rx - lx) / 3;
	double ly1 = ly + (ry - ly) / 3;
	double rx1 = rx - (rx - lx) / 3;
	double ry1 = ry - (ry - ly) / 3;
	// 物理A1の回転行列思い出して、どうぞ
	double cx = lx1 + (rx1 - lx1) * cos(PI / 3) - (ry1 - ly1) * sin(PI / 3);
	double cy = ly1 + (rx1 - lx1) * sin(PI / 3) + (ry1 - ly1) * cos(PI / 3);
	
	koch(count - 1, lx, ly, lx1, ly1);
	printf("%f %f\n", lx1, ly1);
	koch(count - 1, lx1, ly1, cx, cy);
	printf("%f %f\n", cx, cy);
	koch(count - 1, cx, cy, rx1, ry1);
	printf("%f %f\n", rx1, ry1);
	koch(count - 1, rx1, ry1, rx, ry);
	
}

int main(void){
	double lx = 0;
	double ly = 0;
	double rx = 100;
	double ry = 0;
	scanf("%d",&n);
	printf("%f %f\n", lx, ly);
	koch(n,0,0,100,0);
	printf("%f %f\n", rx, ry);
	return 0;
}
