#include <stdio.h>
#define PI 3.14159265359
 
void kock(int n, double px1, double py1, double px2, double py2) {
     
    double sx,sy,tx, ty, ux, uy;
    if (n == 0) return;
     
    sx = (2*px1 + 1*px2)/3;
    sy = (2*py1 + 1*py2)/3;
    tx = (1*px1 + 2*px2)/3;
    ty = (1*py1 + 2*py2)/3;
    ux = (tx - sx) * cos(PI/3) - (ty - sy) * sin(PI/3) + sx;
    uy = (tx - sx) * sin(PI/3) + (ty - sy) * cos(PI/3) + sy;
 
     
    kock(n-1, px1, py1, sx, sy);
    printf("%f %f\n",sx, sy);
     
    kock(n-1, sx, sy, ux, uy);
    printf("%f %f\n", ux, uy);
     
    kock(n-1, ux, uy, tx, ty);
    printf("%f %f\n", tx, ty);
     
    kock(n-1, tx, ty, px2, py2);
     
}
 
int main() {
    int n;
    scanf("%d", &n);
     
    printf("0 0\n");
    kock(n, 0, 0, 100, 0);
    printf("100 0\n");
     
    return 0;
}