#include<stdio.h>
#include<math.h>
#define pie 3.1415926535897
 
 void koch(int n,double p1x,double p1y,double p2x,double p2y){
       double sx,sy,tx,ty,ux,uy,th;
       if(n==0)return;
       th=pie*60.0/180.0;
       sx=(p1x*2.0+p2x*1.0)/3.0;
       sy=(p1y*2.0+p2y*1.0)/3.0;
       tx=(p1x*1.0+p2x*2.0)/3.0;
       ty=(p1y*1.0+p2y*2.0)/3.0;
       ux=(tx-sx)*cos(th)-(ty-sy)*sin(th);
       uy=(tx-sx)*sin(th)+(ty-sy)*cos(th);
       koch(n-1,p1x,p1y,sx,sy);
       printf("%f %f\n",sx,sy);
       koch(n-1,sx,sy,ux,uy);
       printf("%f %f\n",ux,uy);
       koch(n-1,ux,uy,tx,ty);
       printf("%f %f\n",tx,ty);
       koch(n-1,tx,ty,p2x,p2y);
       }
                    
 
 int main(){
       int n;
       double p1x;
       double p1y;
       double p2x;
       double p2y;
       p1x=0.0;
       p1y=0.0;
       p2x=100.0;
       p2y=0.0;
        
       scanf("%d",&n);
       printf("%f %f\n",p1x,p1y);
       koch(n,p1x,p1y,p2x,p2y);
       printf("%f %f\n",p2x,p2y);
       return 0;
       }
