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

typedef struct{
  double p;
  double q;
}koch;

int kock(int, koch,koch);

int main()
{

  int n;
  koch X={0.0,0.0},Y={100.0,0.0};

  scanf("%d",&n);

  printf("%f %f\n",X.p,X.q);
  kock(n,X,Y);
  printf("%f %f\n",Y.p,Y.q);

  return 0;
}

int kock(int n, koch X, koch Y)
{
  koch a,b,c;

  if(n==0) return 0;

  a.p=(2*X.p+Y.p)/3;
  a.q=(2*X.q+Y.q)/3;
  b.p=(X.p+2*Y.p)/3;
  b.q=(X.q+2*Y.q)/3;
  c.p=(b.p-a.p)*cos(M_PI/3)-(b.q-a.q)*sin(M_PI/3)+a.p;
  c.q=(b.p-a.p)*sin(M_PI/3)+(b.q-a.q)*cos(M_PI/3)+a.q;

  kock(n-1,X,a);
  printf("%f %f\n",a.p,a.q);
  kock(n-1,a,c);
  printf("%f %f\n",c.p,c.q);
  kock(n-1,c,b);
  printf("%f %f\n",b.p,b.q);
  kock(n-1,b,Y);
  return 1;
}

