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

void koch(int n, double p1[], double p2[]){
    if (n == 0) return;
    
    double s[2], t[2], u[2];
    for (int i = 0; i < 2; i++){
        s[i] = (2.0 * p1[i] + p2[i]) / 3.0;
        t[i] = (2.0 * p2[i] + p1[i]) / 3.0;
    }
    u[0] = (t[0] - s[0]) * 0.5 - (t[1] - s[1]) * sqrt(3.0) * 0.5 + s[0];
    u[1] = (t[0] - s[0]) * sqrt(3.0) * 0.5 + (t[1] - s[1]) * 0.5 + s[1];
    
    koch(n-1, p1, s);
    printf("%f %f\n", s[0], s[1]);
    koch(n-1, s, u);
    printf("%f %f\n", u[0], u[1]);
    koch(n-1, u, t);
    printf("%f %f\n", t[0], t[1]);
    koch(n-1, t, p2);
}

int main(){
    int n = 0;
    scanf("%d", &n);
    double p1[2] = {0.0, 0.0};
    double p2[2] = {100.0, 0.0};
    printf("%f %f\n", p1[0], p1[1]);
    koch(n, p1, p2);
    printf("%f %f\n", p2[0], p2[1]);
}
