#define _USE_MATH_DEFINES
#include<stdio.h>
#include<math.h>
 
void koch(int n, double d, double x, double y, int w)
{
    double r;
    double x1, y1;
    if(n == 0){
        r = w*M_PI/180.0;
        x1 = x + d * cos(r);
        y1 = y + d * sin(r);
        printf("%.8lf %.8lf\n", x1, y1);
        return;
    }
 
    d /= 3;
    koch(n - 1, d, x, y, w);
 
    r = w*M_PI/180.0;
    x = x + d * cos(r);
    y = y + d * sin(r);
 
    w += 60;
    koch(n - 1, d, x, y, w);
 
    r = w*M_PI/180.0;
    x = x + d * cos(r);
    y = y + d * sin(r);
 
    w += -120;
    koch(n - 1, d, x, y, w);
 
    r = w*M_PI/180.0;
    x = x + d * cos(r);
    y = y + d * sin(r);
 
    w += 60;
    koch(n - 1, d, x, y, w);
 
    return;
}
 
int main()
{
    int n;
    double x, y;
 
    scanf("%d", &n);
    x = y = 0;
    printf("%.8lf %.8lf\n", x, y);
    koch(n, 100, x, y, 0);
 
    return(0);
}