/* 17D8102015F 岩男悠生 */
/* 10/24 ALDS1_5_C*/

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

#define PI 3.141592653589793
double radian = 60 * PI / 180.0;

void fk(double s[], double t[], int n, int i);
double dis(double x[], double y[]);

int main()
{
    int n,m,i,con;
    double p1[2] = {0,0};
    double p2[2] = {100,0};

    scanf("%d",&n);

    printf("%f %f\n",p1[0], p1[1]);
    if (n > 0) {
        fk(p1,p2,n-1,1);
    }
    printf("%f %f\n",p2[0], p2[1]);

    return 0;
}

void fk(double s[], double t[], int n, int i) {
    double a[2],b[2],c[2];

    a[0] = s[0] + (t[0]-s[0])/3;
    a[1] = s[1] + (t[1]-s[1])/3;
    c[0] = s[0] + ((t[0]-s[0])/3)*2;
    c[1] = s[1] + ((t[1]-s[1])/3)*2;
    b[0] = a[0] + dis(a,c)*cos(radian*i);
    b[1] = a[1] + dis(a,c)*sin(radian*i);

    if (n > 0) {
        fk(s, a, n-1,i);
    }
    printf("%f %f\n",a[0], a[1]);
    if (n > 0) {
        fk(a, b, n-1,i+1);
    }
    printf("%f %f\n",b[0], b[1]);
    if (n > 0) {
        fk(b, c, n-1,i-1);
    }
    printf("%f %f\n",c[0], c[1]);
    if (n > 0) {
        fk(c, t, n-1,i);
    }
}

double dis(double x[], double y[]) {
    return sqrt(pow(y[0]-x[0],2)+pow(y[1]-x[1],2));
}
