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

double c, s;

void printkoch(int n, double p1x, double p1y, double p2x, double p2y){
    double sx = (p1x * 2 + p2x) / 3;
    double sy = (p1y * 2 + p2y) / 3;
    double tx = (p1x + p2x * 2) / 3;
    double ty = (p1y + p2y * 2) / 3;
    double ux = sx + (tx - sx) * c - (ty - sy) * s;
    double uy = sy + (tx - sx) * s + (ty - sy) * c;
    if(n == 0){
        printf("%f %f\n", p1x, p1y);
    }else{
        printkoch(n-1, p1x, p1y, sx, sy);
        printkoch(n-1, sx, sy, ux, uy);
        printkoch(n-1, ux, uy, tx, ty);
        printkoch(n-1, tx, ty, p2x, p2y);
    }
}

int main(){
    c = cos(M_PI/3);
    s = sin(M_PI/3);
    int n;
    scanf("%d", &n);
    printkoch(n, 0.0, 0.0, 100.0, 0.0);
    printf("%f %f\n", 100.0, 0.0);
}

