#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

struct Point {
    double x;
    double y;
};

static double cos_60;
static double sin_60;

static void init_sin_cos(void){
    cos_60 = cos(M_PI / 3.0);
    sin_60 = sin(M_PI / 3.0);
    
    return;
}
       

static void GetPos(const struct Point* p1, const struct Point* p2, struct Point* s, struct Point* t, struct Point* u) {
      /* y = a (x - x1) + y1,  a = (y2 - y1) / (x2 - x1) */
    double a = (p2->y - p1->y) / ( p2->x - p1->x);

    s->x = (p2->x - p1->x) / 3.0 + p1->x;
    s->y = a * (s->x - p1->x) + p1->y;

    t->x = (p2->x - p1->x) * 2.0 / 3.0 + p1->x;
    t->y = a * (t->x - p1->x) + p1->y;

    u->x = (t->x - s->x) * cos_60 - (t->y - s->y) * sin_60 + s->x;
    u->y = (t->x - s->x) * sin_60 + (t->y - s->y) * cos_60 + s->y;
    
    return;
}


static void Kock(int n, const struct Point* p1, const struct Point* p2) {
    struct Point s, t, u;

    if ( n == 0 ) {
        return;
    }

    GetPos(p1, p2, &s, &t, &u);

    Kock( n - 1, p1, &s);
    printf("%lf %lf\n", s.x, s.y);
    Kock( n - 1, &s, &u);
    printf("%lf %lf\n", u.x, u.y);    
    Kock( n - 1, &u, &t);
    printf("%lf %lf\n", t.x, t.y);    
    Kock( n - 1, &t, p2);

    return;
}


int main(void) {
    int n;
    struct Point p1 = { .x = 0, .y = 0};
    struct Point p2 = { .x = 100, .y = 0};

    init_sin_cos();

    scanf("%d\n", &n);

    printf("%lf %lf\n", p1.x, p1.y);
    Kock(n, &p1, &p2);
    printf("%lf %lf\n", p2.x, p2.y);

    return 0;
}
        

