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

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

void rec(int n, point p1, point p2) {
    if (n == 0) {
        printf("%lf %lf\n", p2.x, p2.y);
    } else {
        point s, t, u;
        s.x = 2 * p1.x / 3 + p2.x / 3;
        s.y = 2 * p1.y / 3 + p2.y / 3;
        t.x = (p1.x + p2.x) / 2 - sqrt(3) * (p2.y - p1.y) / 6;
        t.y = (p1.y + p2.y) / 2 + sqrt(3) * (p2.x - p1.x) / 6;
        u.x = p1.x / 3 + 2 * p2.x / 3;
        u.y = p1.y / 3 + 2 * p2.y / 3;
        rec(n - 1, p1, s);
        rec(n - 1, s, t);
        rec(n - 1, t, u);
        rec(n - 1, u, p2);
    }
}

void koch(int n, point p1, point p2) {
    printf("%lf %lf\n", p1.x, p1.y);
    rec(n, p1, p2);
}

int main(void) {
    int n;
    point p1 = {0, 0};
    point p2 = {100, 0};
    scanf("%d", &n);
    koch(n, p1, p2);
}

