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

void koch(double x0, double y0, double x4, double y4, int d){
    assert(d>=0);
    if(d==0){
        printf("%.8lf ", x0);
        printf("%.8lf\n", y0);
    } else {
    double x1 = x0 + (x4-x0)/(double)3;
    double y1 = y0 + (y4-y0)/(double)3;
    double x3 = x0 + (x4-x0) * (double)2 / (double)3;
    double y3 = y0+ (y4-y0) * (double)2/  (double)3;

    double mx = (x0+x4)/(double)2;
    double my = (y0+y4)/(double)2;
    double distance = hypot(x4-x0,y4-y0) * sqrt(3) / (double)6;
    double x2 = mx + distance * (y0-y4) / hypot(y0-y4,x4-x0);
    double y2 = my + distance * (x4-x0) / hypot(y0-y4,x4-x0);
    
    koch(x0,y0,x1,y1,d-1);
    koch(x1,y1,x2,y2,d-1);
    koch(x2,y2,x3,y3,d-1);
    koch(x3,y3,x4,y4,d-1);
    }
}

int main(void){
    int n;
    scanf("%d",&n);
    koch((double)0, (double)0, (double)100, (double)0, n);
    printf("%.8lf ", (double)100);
    printf("%.8lf\n", (double)0);
    return 0;
}
