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

typedef struct point{
  double x,y;
}point;

void cohho(int,point,point);

void cohho(int n,point a,point b)
{
  point A,B,C;
  double z = M_PI * 60.0 / 180.0;
  
  if(n == 0)
    return;

  A.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  A.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
  B.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
  B.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
  C.x = (B.x - A.x) * cos(z) - (B.y - A.y) * sin(z) + A.x;
  C.y = (B.x - A.x) * sin(z) + (B.y - A.y) * cos(z) + A.y;

  cohho(n-1,a,A);
  printf("%.8f %.8f\n",A.x,A.y);
  cohho(n-1,A,C);
  printf("%.8f %.8f\n",C.x,C.y);
  cohho(n-1,C,B);
  printf("%.8f %.8f\n",B.x,B.y);
  cohho(n-1,B,b);
}
  
int main()
{
  point a,b;
  int n;

  scanf("%d",&n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n",a.x,a.y);
  cohho(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}
  

