#include <stdio.h>
#include <math.h>
int n;
struct point{
  double x;
  double y;
};
void print_point(struct point p){
  printf("%.8f %.8f\n",p.x,p.y);
}
void compute(int depth,double x1,double y1,double x2,double y2)
{
  double sin60 = sqrt(3.0)/2.0;
  double cos60 = 0.5;
  struct point s,t,u,v;
 
  s.x = (x1+x1+x2)/3.0;
  s.y = (y1+y1+y2)/3.0;
  t.x = (x1+x2+x2)/3.0;
  t.y = (y1+y2+y2)/3.0;
  v.x = t.x-s.x;
  v.y = t.y-s.y;
  u.x = s.x + cos60*v.x - sin60*v.y;
  u.y = s.y + sin60*v.x + cos60*v.y;
 
  if(depth>= n) return;
 
  compute(depth +1,x1,y1,s.x,s.y);
  printf("%.8f %.8f\n",s.x,s.y);
  compute(depth +1,s.x,s.y,u.x,u.y);
  printf("%.8f %.8f\n",u.x,u.y);
  compute(depth+1,u.x,u.y,t.x,t.y);
  printf("%.8f %.8f\n",t.x,t.y);
  compute(depth+1,t.x,t.y,x2,y2);
}
 
 
 
 
int main(void)
{
  scanf("%d",&n);
  printf("%.8f %.8f\n",0.0,0.0);
  compute(0,0.0,0.0,100.0,0.0);
  printf("%.8f %.8f\n",100.0,0.0);
  return 0;
}