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

struct point {
        double x;
        double y;
};

static void
koch(int num, struct point p1, struct point p2)
{
        struct point s, t;
        struct point u;
        double theta = M_PI * 60.0 / 180.0;

        if (num == 0)
                return;

        s.x = ((p1.x * 2.0) + p2.x) / 3.0;
        s.y = ((p1.y * 2.0) + p2.y) / 3.0;
        t.x = (p1.x + (p2.x * 2.0)) / 3.0;
        t.y = (p1.y + (p2.y * 2.0)) / 3.0;

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

        num--;

        koch(num, p1, s);
        printf("%.8f %.8f\n", s.x, s.y);

        koch(num, s, u);
        printf("%.8f %.8f\n", u.x, u.y);

        koch(num, u, t);
        printf("%.8f %.8f\n", t.x, t.y);

        koch(num, t, p2);
}

int
main(void)
{
        struct point p1, p2;
        int num;

        scanf("%d", &num);

        p1.x = 0.0;
        p1.y = 0.0;
        p2.x = 100.0;
        p2.y = 0.0;

        printf("%.8f %.8f\n", p1.x, p1.y);
        koch(num, p1, p2);
        printf("%.8f %.8f\n", p2.x, p2.y);

        return 0;
}

