#include<stdio.h>
#include<math.h>
#define PI acos(-1)
int limit;
void koch(double*, double*, int);
main()
{
        int count = 1;
        double start[2] = {0, 0}, end[2] = {100, 0};
        scanf("%d", &limit);
        printf("%.5f %.5f\n", start[0], start[1]);
        if(!limit){
            koch(start, end, count);
        }
        printf("%.5f, %.5f\n", end[0], end[1]);
}
void koch(double *start, double *end, int count)
{
        int i;
        double mid[3][2];
        for(i = 0; i < 2; i++){
                mid[0][i] = (2 * start[i] + end[i]) / 3;
                mid[2][i] = (start[i] + 2 * end[i]) / 3;
        }
        mid[1][0] = mid[0][0] + ((mid[2][0] - mid[0][0]) * cos(PI / 3)
                                                         - (mid[2][1] - mid[0][1]) * sin(PI / 3));
        mid[1][1] = mid[0][1] + ((mid[2][0] - mid[0][0]) * sin(PI / 3)
                             + (mid[2][1] - mid[0][1]) * cos(PI / 3));
        if(count == limit){
                for(i = 0; i < 3; i++){
                        printf("%.5f, %.5f\n", mid[i][0], mid[i][1]);
                }
        }else{
                count++;
                koch(start, mid[0],count);
                printf("%.5f, %.5f\n", mid[0][0], mid[0][1]);
                koch(mid[0], mid[1], count);
                printf("%.5f, %.5f\n", mid[1][0], mid[1][1]);
                koch(mid[1], mid[2], count);
                printf("%.5f, %.5f\n", mid[2][0], mid[2][1]);
                koch(mid[2], end, count);
        }
}