#include<stdio.h>
#include<math.h>
 
int koch(double x1,double y1,double x2,double y2,int n){

  if(n==0){
    printf("%f %f\n",x2,y2);
    return 0;
  }

  double Ax,Ay,Bx,By,Cx,Cy;
  Ax=(x2-x1)/3+x1;
  Ay=(y2-y1)/3+y1;
  Bx=(x2-x1)*2/3+x1;
  By=(y2-y1)*2/3+y1;
  Cx=(cos(M_PI/3)*(Bx-Ax)-sin(M_PI/3)*(By-Ay))+Ax;
  Cy=(sin(M_PI/3)*(Bx-Ax)+cos(M_PI/3)*(By-Ay))+Ay;
  koch(x1, y1, Ax, Ay, n-1);
  koch(Ax, Ay, Cx, Cy, n-1);
  koch(Cx, Cy, Bx, By, n-1);
  koch(Bx, By, x2, y2, n-1);
   
}


int main(){
  int n;
  double x1=0,y1=0,x2=100,y2=0;
  scanf("%d",&n);
  printf("0.00000000 0.00000000\n");
  koch(x1,y1,x2,y2,n);
  return 0;
}