#include<stdio.h>
#include<math.h>
  
typedef struct{
  double x;
  double y; 
}xx;
 
void fanc(int n,xx p1,xx p2){  
  xx a,b,c;
  if (n==0) return ;
  a.x=(2.0*p1.x+1.0*p2.x)/3.0;
  a.y=(2.0*p1.y+1.0*p2.y)/3.0;
  b.x=(1.0*p1.x+2.0*p2.x)/3.0;
  b.y=(1.0*p1.y+2.0*p2.y)/3.0;
  c.x=(b.x-a.x)*(cos(M_PI/3.0))-(b.y-a.y)*(sin(M_PI/3.0))+a.x;
  c.y=(b.x-a.x)*(sin(M_PI/3.0))+(b.y-a.y)*(cos(M_PI/3.0))+a.y;
  fanc(n-1,p1,a);
  printf("%lf %lf\n",a.x,a.y); 
  fanc(n-1,a,c);
  printf("%lf %lf\n",c.x,c.y);
  fanc(n-1,c,b);
  printf("%lf %lf\n",b.x,b.y);
  fanc(n-1,b,p2);
}
int main( ){
  xx p1,p2;
  int n;
  p1.x=0.0;
  p1.y=0.0;
  p2.x=100.0;
  p2.y=0.0;
  scanf("%d",&n); 
  printf("%lf %lf\n",p1.x,p1.y);
  fanc(n,p1,p2);
  printf("%lf %lf\n",p2.x,p2.y); 
  return 0;
}