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

typedef struct {
    float x;
    float y;
} Vector;


void printVectorEndl(Vector u) {
    printf("%f %f\n", u.x, u.y);
}

void fractalGeneration (
    Vector begin, 
    Vector end, 
    int remainingNumberOfGenerations
) 
{
    remainingNumberOfGenerations--;
    
    // end if no remaining generations
    if (remainingNumberOfGenerations < 0) {
        printVectorEndl(begin);
        return;
    }
    
    // distance from begin to end
    float d = sqrt( // sqrt(Dx^2 + Dy^2)
        (end.x - begin.x) * (end.x - begin.x) + 
        (end.y - begin.y) * (end.y - begin.y)   
    );
    // unit parallel vector
    Vector parallel_unit = { 
        (end.x - begin.x) / d,
        (end.y - begin.y) / d
    };
    // unit perpendicular vector
    Vector perpendicular_unit = {
        -parallel_unit.y, 
         parallel_unit.x
    };
    
    // find points in between begin and end
    Vector A = {
        d/3 * parallel_unit.x   +begin.x,
        d/3 * parallel_unit.y   +begin.y
    };
    Vector B = {
        d/6 * parallel_unit.x + d*sqrt(3)/6 * perpendicular_unit.x   +A.x,
        d/6 * parallel_unit.y + d*sqrt(3)/6 * perpendicular_unit.y   +A.y
    };
    Vector C = {
        d/3 * parallel_unit.x   +A.x,
        d/3 * parallel_unit.y   +A.y
    };
    
    // do next generation
    fractalGeneration(begin , A     , remainingNumberOfGenerations);
    fractalGeneration(A     , B     , remainingNumberOfGenerations);
    fractalGeneration(B     , C     , remainingNumberOfGenerations);
    fractalGeneration(C     , end   , remainingNumberOfGenerations);
};

int main(int argc, char** argv) {
    int n;
    scanf("%d", &n);
    
    Vector begin = {0,0};
    Vector end = {100, 0};
    
    fractalGeneration(begin,end,n);
    printVectorEndl(end);
    
    return (EXIT_SUCCESS);
}


