#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

//============================================================================
#define pred(x) ((x)-1)
#define succ(x) ((x)+1)
//============================================================================
//============================================================================
#define P_START 0.0
#define P_FINISH 100.0
//============================================================================
#define PI 3.141592653589793
#define DMAX 0.005
#define MAXN 6
unsigned int a;
double d, lsX,lsY,costbl[MAXN], sintbl[MAXN];

void koch(int n)
{
    double x,y;
    if (!n){
		x=d * costbl[a % MAXN]+lsX; y=d * sintbl[a % MAXN]+lsY;
        printf("%lf %lf\n", x, y);
        lsX=x, lsY=y;
	}else {
		n--; d /= 3;  koch(n);  a++;  koch(n);
		a += 4;  koch(n);  a++;  koch(n);
		d *= 3;
	}
}
//----------------------------------------------------------------------------
void input(FILE *file)
{
    short n;

    fscanf(file, "%hd", &n);
	for (a = 0; a < MAXN; a++) {
		costbl[a] = cos(a * PI / 3);
		sintbl[a] = sin(a * PI / 3);
	}
    d = P_FINISH;  a = 0; lsX=lsY=P_START;
    printf("%lf %lf\n", lsX, lsY);
    koch(n);
}
//============================================================================
#ifndef DESKTOP
int main()
{
    input(stdin);
    return 0;
}
#endif