#include<stdio.h>
#include<math.h>
struct point {
    double x, y;
};
void koch(int n, struct point a, struct point b) {
    if ( n == 0) return;
    struct point s, t, u;
    double rad = 3.1415926535897932384626 / 3;
    s.x = ( 2 * a.x + b.x ) / 3;
    s.y = ( 2 * a.y + b.y ) / 3;
    t.x = ( a.x + 2 * b.x ) / 3;
    t.y = ( a.y + 2 * b.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;
 
    koch(n - 1, a, s);
    if ( s.x < 0 ) s.x *= -1;
    if ( s.y < 0 ) s.y *= -1;
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n - 1, s, u);
    if ( u.x < 0 ) u.x *= -1;
    if ( u.y < 0 ) u.y *= -1;
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n - 1, u, t);
    if ( t.x < 0 ) t.x *= -1;
    if ( t.y < 0 ) t.y *= -1;
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n - 1, t, b);
}
 
int main(void) {
    struct point p, q;
    int n;
    scanf("%d", &n);
    p.x = 0;
    p.y = 0;
    q.x = 100;
    q.y = 0;
    printf("%.8f %.8f\n", p.x, p.y);
    koch(n, p, q);
    printf("%.8f %.8f\n", q.x, q.y);
 
    return 0;
}