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


int a;
double b;
double v_sin[15];
double v_cos[15];
double x, y;

void koch_curve(int p);

int main(void)
{
    int n;
    for (int i = 0; i < 6; i++) v_cos[i] = cos(i*M_PI/3), v_sin[i]=sin(i*M_PI/3);
    scanf("%d", &n);
    b = 100;
    a = 0, x = 0, y = 0; puts("0.00000000 0.00000000");
    koch_curve(n);
    return 0;
}

void koch_curve(int p)
{
    if (p == 0) {
        x =x+ b*v_cos[a % 6], y += b*v_sin[a%6];
        printf("%.8lf %.8lf\n", x, y);
    }
    else {
        b =b/3;
        koch_curve(p-1), a++, koch_curve(p-1);
        a =a+4;
        koch_curve(p-1), a++, koch_curve(p-1);
        b =b*3;
    }
}





