#include <stdio.h>
#include <math.h>
typedef struct a{
  double x;
  double y;
}Point;
void kohho(Point,Point,int);
Point start,end;
int main(){
  int n;
  start.x=0;
  start.y=0;
  end.x=100;
  end.y=0;
  scanf("%d",&n);
  printf("%f %f\n",start.x,start.y);
  kohho(start,end,n);
  printf("%f %f\n",end.x,end.y);
  return 0;
}
void kohho(Point p1,Point p2,int dipth){
  if(dipth==0)return;
  Point s,t,u;
  s.x=(2*p1.x+p2.x)/3;
  s.y=(2*p1.y+p2.y)/3;
  t.x=(p1.x+2*p2.x)/3;
  t.y=(p1.y+2*p2.y)/3;
  u.x=(t.x-s.x)*cos(M_PI*60.0/180.0)-(t.y-s.y)*sin(M_PI*60.0/180.0)+s.x;
  u.y=(t.x-s.x)*sin(M_PI*60.0/180.0)-(t.y-s.y)*cos(M_PI*60.0/180.0)+s.y;
  kohho(p1,s,dipth-1);
  printf("%f %f\n",s.x,s.y);
  kohho(s,u,dipth-1);
  printf("%f %f\n",u.x,u.y);
  kohho(u,t,dipth-1);
  printf("%f %f\n",t.x,t.y);
  kohho(t,p2,dipth-1);
}

