#include<stdio.h>
#include<math.h>
 
typedef struct koch{
  double x;
  double y;
}Koch;
 
void point(int , Koch, Koch );
 
int main(){
  Koch x,y; 
  int n;
  
  scanf("%d",&n);

  x.x=0;
  x.y=0;
  y.x=100;
  y.y=0;
    
  printf("%.8f %.8f\n",x.x,x.y);
  point(n,x,y);   
  printf("%.8f %.8f\n",y.x,y.y);
 
  return 0;
}

void point(int n ,Koch x ,Koch y){ 
  Koch a,b,c;
  double r=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(r)-(b.y-a.y)*sin(r)+a.x;
  c.y=(b.x-a.x)*sin(r)+(b.y-a.y)*cos(r)+a.y;
    
  if(n>0){
  point(n-1,x,a);
  printf("%.8f %.8f\n",a.x,a.y);
  point(n-1,a,c);
  printf("%.8f %.8f\n",c.x,c.y);
  point(n-1,c,b);
  printf("%.8f %.8f\n",b.x,b.y);
  point(n-1,b,y); 
  } 
}
