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

typedef struct{
  double x,y;
} point;

void koch(int N, point a, point b)
{
  point l, m, n;
  double d = M_PI * 60.0 / 180.0;
  
  if (N == 0)
    return;
  l.x = (2.0*a.x + 1.0*b.x) / 3.0;
  l.y = (2.0*a.y + 1.0*b.y) / 3.0;
  m.x = (1.0*a.x + 2.0*b.x) / 3.0;
  m.y = (1.0*a.y + 2.0*b.y) / 3.0;
  n.x = (m.x-l.x) * cos(d) - (m.y - l.y) * sin(d) + l.x;
  n.y = (m.x-l.x) * sin(d) + (m.y - l.y) * cos(d) + l.y;
  koch(N-1,a,l);
  printf("%.8f %.8f\n",l.x,l.y);
  koch(N-1,l,n);
  printf("%.8f %.8f\n",n.x,n.y);
  koch(N-1,n,m);
  printf("%.8f %.8f\n",m.x,m.y);
  koch(N-1,m,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);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}

