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

void kock(int n, double x1,double  y1, double  x2,double y2); 
int main(){
 
  int n;
  double x1 = 0.0, y1 = 0.0;
  double x2 = 100.0, y2 = 0.0;
 
  scanf("%d",&n);
  printf("%.8f %.8f\n",x1,y1);
  kock(n, x1,y1, x2,y2);
  printf("%.8f %.8f\n",x2,y2);
  return 0;
}
  
void kock(int n, double x1,double  y1, double  x2,double y2){
  double ox,oy, px,py, qx,qy;
  if (n > 0){
 
  ox = (2 * x1 + 1 * x2) / 3 ;
  oy = (2 * y1 + 1 * y2) / 3 ;
 
  px = (1 * x1 + 2 * x2) / 3 ;
  py = (1 * y1 + 2 * y2) / 3 ;
 
  qx = ((px - ox) * cos(M_PI / 3) - (py - oy) * sin(M_PI / 3)) + ox;
  qy = ((px - ox) * sin(M_PI / 3) + (py - oy) * cos(M_PI / 3)) + oy;
   
 
  kock(n-1, x1,y1, ox,oy);
  printf("%.8f %.8f\n",ox,oy);
  kock(n-1, ox,oy, qx,qy);
  printf("%.8f %.8f\n",qx,qy);
  kock(n-1, qx,qy, px,py);
  printf("%.8f %.8f\n",px,py);
  kock(n-1, px,py, x2,y2);
  }
}


