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

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

void koch(Vec a, Vec b, int n) {
    Vec s, t, u;
    double rad = M_PI * 60.0 / 180.0;
    if (n == 0) return;

    s.x = (2 * a.x + b.x) / 3.0;
    s.y = (2 * a.y + b.y) / 3.0;
    t.x = (a.x + 2 * b.x) / 3.0;
    t.y = (a.y + 2 * b.y) / 3.0;

    u.x = (t.x - s.x) * cos(rad) - (t.y - s.y) * sin(rad) + s.x;
    u.y = (t.x - s.x) * sin(rad) + (t.y - s.y) * cos(rad) + s.y;

    koch(a, s, n-1);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(s, u, n-1);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(u, t,n-1);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(t, b,n-1);
}

int main() {
    Vec a, b;
    int n;

    scanf("%d", &n);

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    printf("%.8f %.8f\n", a.x, a.y);
    koch(a, b, n);
    printf("%.8f %.8f\n", b.x, b.y);
    return 0;
}

