#include <stdio.h>          
#include <math.h>           
 
typedef struct point_tbl
{
    double x;
    double y;
} point;
 
void koch(int n, point p, point q)
{
    point a, b, c;
 
    if (n == 0)
        return;
 
    double T = M_PI * 60.0 / 180.0;
 
    a.x = (2.0 * p.x + 1.0 * q.x) / 3.0;
    a.y = (2.0 * p.y + 1.0 * q.y) / 3.0;
    b.x = (1.0 * p.x + 2.0 * q.x) / 3.0;
    b.y = (1.0 * p.y + 2.0 * q.y) / 3.0;
    c.x = (b.x - a.x) * cos(T) - (b.y - a.y) * sin(T) + a.x;
    c.y = (b.x - a.x) * sin(T) + (b.y - a.y) * cos(T) + a.y;
 
    koch(n - 1, p, a);
    printf("%.8f %.8f\n", a.x, a.y);
    koch(n - 1, a, c);
    printf("%.8f %.8f\n", c.x, c.y);
    koch(n - 1, c, b);
    printf("%.8f %.8f\n", b.x, b.y);
    koch(n - 1, b, q);
}
 
int
main(int argc, char** argv)
{
    point aa, bb;
    int i;
 
    scanf("%d", &i);
    aa.x = 0, aa.y = 0;
    bb.x = 100, bb.y = 0;
 
    printf("%.8f %.8f\n", aa.x, aa.y);
    koch(i, aa, bb);
    printf("%.8f %.8f\n", bb.x, bb.y);
 
    return 0;
}
