#include <stdio.h>
#include <math.h>
#define ld long double

typedef struct {ld x, y;} Vector;
ld rad = 3.141592653589793 * 60.00000000 / 180.00000000;

void koch(int d, Vector p1, Vector p2) {
    if (d == 0) return;
    Vector s, u, t;
    s.x = (2.0*p1.x + 1.0*p2.x) / 3.0;
    s.y = (2.0*p1.y + 1.0*p2.y) / 3.0;
    t.x = (1.0*p1.x + 2.0*p2.x) / 3.0;
    t.y = (1.0*p1.y + 2.0*p2.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(d-1, p1, s);
    printf("%Lf %Lf\n", s.x, s.y);
    koch(d-1, s, u);
    printf("%Lf %Lf\n", u.x, u.y);
    koch(d-1, u, t);
    printf("%Lf %Lf\n", t.x, t.y);
    koch(d-1, t, p2);
}

int main(void) {
    int n;
    scanf("%d", &n);
    Vector a, b;
    a.x = 0.00000000; a.y = 0.00000000;
    b.x = 100.00000000; b.y = 0.00000000;
    printf("%Lf %Lf\n", a.x, a.y);
    koch(n, a, b);
    printf("%Lf %Lf\n", b.x, b.y);
    return 0;
}
