#include <stdio.h>

#define sin 0.86602540378
#define cos 0.5


void kock(int,int,int,int,int);
int main(){
    int n,p1=0,p2=100;
    scanf("%d",&n);
    printf("%.8f\n",(double)p1);
    kock(n,p1,0,p2,0);
    printf("%.8f\n",(double)p2);
    return 0;
}

void kock(n,p1x,p1y,p2x,p2y){
    if( n == 0)return;
    double sx,sy,tx,ty,ux,uy;


    sx=(double)(p1x*2+p2x)/3;
    sy=(double)(p1y*2+p2y)/3;
    tx=(double)(p1x+p2x*2)/3;
    ty=(double)(p1y+p2y*2)/3;
    
    ux=(double)(tx-sx)*cos-(double)(ty-sy)*sin;
    uy=(double)(tx-sx)*sin+(double)(ty-sy)*cos;
    
    kock(n-1,p1x,p1y,sx,sy);
    printf("%.8f %.8f\n",sx,sy);
    
    kock(n-1,sx,sy,ux,uy);
    printf("%.8f %.8f\n",ux,uy);
    
    kock(n-1, ux,uy, tx,ty);
    printf("%.8f %.8f\n",tx,ty);
    
    kock(n-1, tx,ty, p2x,p2y);
}