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

typedef struct Point{
  double x,y;
}P;

void koch(int ,P,P);

int main()
{
  P a1,a2;
  int n;
  scanf("%d",&n);

  a1.x=0.0;
  a1.y=0.0;
  a2.x = 100.0;
  a2.y = 0.0;


  printf("%.8f %.8f\n",a1.x,a1.y);
  koch(n,a1,a2);
  printf("%.8f %.8f\n",a2.x,a2.y);

  return 0;

}

void koch(int n, P a1,P a2)
{
  double razian;
  P s,t,u;
  if(n==0){ return;}
  razian = M_PI*60.0/180.0;
  s.x=(2.0*a1.x +1.0*a2.x) /3.0;
  s.y=(2.0*a1.y +1.0*a2.y) /3.0;
  t.x=(1.0*a1.x +2.0*a2.x) /3.0;
  t.x=(1.0*a1.y +2.0*a2.y) /3.0;
  u.x = (t.x-s.x)*cos(razian) - (t.y-s.y)*sin(razian) + s.x;
  u.x = (t.x-s.x)*sin(razian) + (t.y-s.y)*cos(razian) + s.y;
  
  
  koch(n-1,a1,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,a2);
}


  