#include<stdio.h>
#include<math.h>




struct Node{
  double x;
  double y;
};



void koch(int n, struct Node x, struct Node y ){


  struct Node a,b,c;
  double radian=M_PI*60.0/180.0;

  if(n==0){return;}

  
  a.x=(2.0*x.x + y.x)/3.0;
  a.y=(2.0*x.y + y.y)/3.0;

  b.x=(x.x + 2.0*y.x)/3.0;
  b.y=(x.y + 2.0*y.y)/3.0;


  
  c.x=(b.x-a.x)*cos(radian)-(b.y-a.y)*sin(radian)+a.x;
  c.y=(b.x-a.x)*sin(radian)+(b.y-a.y)*cos(radian)+a.y;



  
  if(n>0){
  koch(n-1,x,a);
  printf("%.8f %.8f\n",a.x,a.y);

  koch(n-1,a,c);
  printf("%.8f %.8f\n",c.x,c.y);

  koch(n-1,c,b);
  printf("%.8f %.8f\n",b.x,b.y);

  koch(n-1,b,y);
  
  }



}

int main(){
  struct Node a,b;
  
  int number;
  scanf("%d",&number);
  
  
  a.x=0;
  b.x=100;
  a.y=0;
  b.y=0;

  
  printf("%.8f %.8f\n",a.x,a.y);
  koch(number,a,b);

  
  printf("%.8f %.8f\n",b.x,b.y);

  
  return 0;
}

