#include <stdio.h>
#include <math.h>
struct _point {
    double x;
    double y;
};

/*
struct _line {
    int x1;
    int y1;
    int x2;
    int y2;
};
*/
struct _point rotate_pi_3(struct _point o, struct _point a) {
    struct _point a_rotate;
    a_rotate.x = o.x + (a.x - o.x)/2.0 - pow(3.0,0.5)/2.0 * (a.y - o.y);
    a_rotate.y = o.y + pow(3.0,0.5) / 2.0 * (a.x - o.x) + (a.y - o.y) / 2.0;
    return a_rotate;
} 

int koch(struct _point a, struct _point b, int n) {
    if(n == 0) {
        printf("%lf %lf\n",a.x,a.y);
        return 1;
    }
    struct _point na = {a.x + (b.x - a.x)/3.0, a.y + (b.y - a.y)/3.0};
    struct _point nb = {a.x + (b.x - a.x) * (2.0/3.0), a.y + (b.y - a.y) * (2.0/3.0)};
    struct _point nc =rotate_pi_3(na,nb);
    n--;
    koch(a,na,n);
    koch(na,nc,n);
    koch(nc,nb,n);
    koch(nb,b,n);    
    return 0;
}

int main() 
{
    int n;
    scanf("%d",&n);
    struct _point a = {0.0,0.0};
    struct _point b = {100.0,0.0};
    koch(a,b,n);
    printf("%lf %lf\n",b.x,b.y);
    return 0; 
}
