/* ALDS1_5_C: Koch Curve */
/* 20181119 */

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

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

#define rad M_PI / 3

typedef struct {
	double x;
	double y;
} Point;

void cochCurve(Point start_p, Point end_p, int n);
Point rotatePoint(Point p1, Point p3);
void printPoint(Point p);

int main(void){
	int n;
	Point start_p = {0, 0}, end_p = {100, 0};
	scanf("%d", &n);

	printPoint(start_p);
	cochCurve(start_p, end_p, n);
	printPoint(end_p);

	return  0;
}

void cochCurve(Point start_p, Point end_p, int n){
	if(n == 0) return ;

	Point p1 = {start_p.x + (end_p.x - start_p.x) / 3, start_p.y + (end_p.y - start_p.y) / 3};
	Point p3 = {start_p.x + 2 * (end_p.x - start_p.x) / 3, start_p.y + 2 * (end_p.y - start_p.y) / 3};
	Point p2 = rotatePoint(p1, p3);
	
	cochCurve(start_p, p1, n - 1);
	printPoint(p1);
	cochCurve(p1, p2, n-1);
	printPoint(p2);
	cochCurve(p2, p3, n-1);
	printPoint(p3);
	cochCurve(p3, end_p, n - 1);
}

Point rotatePoint(Point p1, Point p3){
	double x = p3.x - p1.x;
	double y = p3.y - p1.y;
	Point p2 = {p1.x + (x * cos(rad)- y * sin(rad)), p1.y +(x * sin(rad) + y * cos(rad))};

	return p2;
}

void printPoint(Point p){
	printf("%lf %lf\n", p.x, p.y);
}
