//三角関数はラジアンで使う。度数記法での引数は異なる結果になる。

#include <stdio.h>
#include <math.h>
#define MAX 100
#define PI 3.14159265359
typedef struct{
    double x, y;
}Point;

void koch( int n, Point p1, Point p2 );

int main(){
    int n;

    Point start_val = {0, 0};
    Point end_val   = {100, 0};
    scanf("%d", &n);
    printf("%f %f\n", start_val.x, start_val.y);
    koch(n, start_val, end_val);
    printf("%f %f\n", end_val.x, end_val.y);
    return 0;
}

void koch( int n, Point p1, Point p2 ){
    Point s, t, u;
    double rad = PI/3;

    if( n == 0 ) return ;
    //calculate
    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(rad) - (t.y-s.y) * sin(rad) + s.x;
    u.y = (t.x-s.x) * sin(rad) + (t.y-s.y) * cos(rad) + s.y;
    
    //recursively
    koch(n-1, p1, s);
    printf("%f %f\n", s.x, s.y);
    koch(n-1, s, u);
    printf("%f %f\n", u.x, u.y);
    koch(n-1, u, t);
    printf("%f %f\n", t.x, t.y);
    koch(n-1, t, p2);
    return ;
}

