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

#define PI 3.1415926535

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

void calcKochCurvePoint(int n, point *p1, point *p2);
void printPoint(point *p);

int main(void)
{
    int n;
    scanf("%d", &n);

    point p1 = {0.0, 0.0};
    point p2 = {100.0, 0.0};

    printPoint(&p1);
    calcKochCurvePoint(n, &p1, &p2);
    printPoint(&p2);

    return 0;
}

void calcKochCurvePoint(int n, point *p1, point *p2)
{
    if (n == 0) {
        return ;
    }

    point s, t, u;
    s.x = (2 * p1->x + p2->x) / 3;
    s.y = (2 * p1->y + p2->y) / 3;
    t.x = (p1->x + 2 * p2->x) / 3;
    t.y = (p1->y + 2 * p2->y) / 3;
    u.x = s.x + (t.x - s.x) * cos(PI / 3) - (t.y - s.y) * sin(PI / 3);
    u.y = s.y + (t.x - s.x) * sin(PI / 3) + (t.y - s.y) * cos(PI / 3);

    calcKochCurvePoint(n - 1, p1, &s);
    printPoint(&s);
    calcKochCurvePoint(n - 1, &s, &u);
    printPoint(&u);
    calcKochCurvePoint(n - 1, &u, &t);
    printPoint(&t);
    calcKochCurvePoint(n - 1, &t, p2);
}

void printPoint(point *p)
{
    printf("%lf %lf\n", p->x, p->y);
}