#include<stdio.h>
#include<math.h>
#define pie 3.1415926535897

 void kock(int n,double p1x,double p1y,double p2x,double p2y){
         double sx,sy,tx,ty,ux,uy;
         if(n==0)return 0;
         sx=(p1x*2+p2x)/3;
         tx=(p1x+p2x*2)/3;
         sy=(p1y*2+p2y)/3;
         ty=(p1y+p2y*2)/3;
         ux=(tx-sx)*cos(pie*60/180)-(ty-sy)*sin(pie*60/180)+sx;
         uy=(tx-sx)*sin(pie*60/180)+(ty-sy)*cos(pie*60/180)+sy;

         kock(n-1,p1x,p1y,sx,sy);
         printf("%lf %lf\n",sx,sy);
         kock(n-1,sx,sy,ux,uy);
         printf("%lf %lf\n",ux,uy);
         kock(n-1,ux,uy,tx,ty);
         printf("%lf %lf\n",tx,ty);
         kock(n-1,tx,ty,p2x,p2y);
         }

 int main(){
        int n;
        double p1x=0.0,p2x=100.0,p1y=0.0,p2y=0.0;
        scanf("%d",&n);
        printf("%lf %lf\n",p1x,p1y);
        kock(n,p1x,p1y,p2x,p2y);
        printf("%lf %lf\n",p2x,p2y);
        return 0;
        }

