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

typedef struct {
  double x;
  double y;
}Point ;
void kohho(int num,Point a,Point b);
int main()
{
  Point p1,p2;
  int num;
  scanf("%d",&num);
  p1.x=0;
  p1.y=0;
  p2.x=100;
  p2.y=0;
  printf("%.8f %.8f\n",p1.x,p1.y);
  kohho(num,p1,p2);
  printf("%.8f %.8f\n",p2.x,p2.y);

  return 0;
}

void kohho(int num ,Point a ,Point b)
{
  Point s,t,u;
  if (num==0)return ;

  s.x =(2.0 * a.x + 1.0 * b.x)/3.0;
  s.y =(2.0 * a.y + 1.0 * b.y)/3.0;
  t.x =(1.0 * a.x + 2.0 * b.x)/3.0;
  t.y =(1.0 * a.y + 2.0 * b.y)/3.0;
  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(num-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  kohho(num-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  kohho(num-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  kohho(num-1,t,b);
}