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

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

void koch(int,P,P);

int main(){
    P p1 = {0,0},p2 = {100,0};
    int d;

    scanf("%d",&d);

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

    return 0;
}

void koch(int d, P p1, P p2){
    P s,t,u;
    double th;
    
    if (d == 0)
        return;

th = M_PI * 60 / 180;
s.x = (2 * p1.x + 1 * p2.x) / 3;
s.y = (2 * p1.y + 1 * p2.y) / 3;
t.x = (1 * p1.x + 2 * p2.x) / 3;
t.y = (1 * p1.y + 2 * p2.y) / 3;
u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(d - 1, p1, s);
    printf("%f %f\n", s.x,s.y);
    koch(d - 1, s, u);
    printf("%f %f\n", u.x,u.y);
    koch(d - 1, u, t);
    printf("%f %f\n", t.x,t.y);
    koch(d - 1, t, p2);

}
