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


void koch(double start_x, double start_y, double end_x, double end_y, int n){
    
    if (n==0) {
        return;
    }
   
    double s_x = (end_x + start_x*2)/3;
    double t_x = (end_x*2 + start_x)/3;
    
    double s_y = (end_y + start_y*2)/3;
    double t_y = (end_y*2 + start_y)/3;
    
    double u_x = (t_x - s_x) / 2 - (t_y - s_y) * sqrt(3) / 2   + s_x;
    double u_y = (t_x - s_x) * sqrt(3) / 2 + (t_y - s_y) / 2   + s_y;
    
    koch(start_x, start_y, s_x, s_y, n-1);
    printf("%f %f\n", s_x, s_y);
    
    koch(s_x, s_y, u_x, u_y, n-1);
    printf("%f %f\n", u_x, u_y);
    
    koch(u_x, u_y, t_x, t_y, n-1);
    printf("%f %f\n", t_x, t_y);
    
    koch(t_x, t_y, end_x, end_y, n-1);

    return;
}

int main( ){
    
    int n;
    
    scanf("%d", &n);
    
    printf("0.00000000 0.00000000\n");
    koch(0.0, 0.0, 100.0, 0.0, n);
    printf("100.00000000 0.00000000\n");
    
    
    return 0;
}