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

typedef struct{
    double x;
    double y;
} P;
void Koch(int,P,P);

int main(){
    int n;
    P f,l;

    scanf("%d",&n);

    f.x = f.y = l.y = 0.0;
    l.x = 100.0;

    printf("%.8f %.8f\n",f.x,f.y);

    Koch(n,f,l);

    printf("%.8f %.8f\n",l.x,l.y);

    return 0;
}

void Koch(int n,P p1,P p2){
    P s,t,u;
    double angle;

    if(n==0){
        return;
    }

    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;
    
    angle = 60 * M_PI / 180.0;

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

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