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

typedef struct{double x,y;  }Point;

void kock(int,Point,Point);

int main()
{
  Point s,t;
  int n;
  scanf("%d",&n);

  s.x=0;
  s.y=0;
  t.x=100;
  t.y=0;

  printf("%.8f %.8f\n",s.x,s.y);
  kock(n,s,t);
  printf("%.8f %.8f\n",t.x,t.y);

  return 0;
}
void kock(int n,Point p1,Point p2)
{
  Point a,b,c;
  double th=M_PI*60.0/180.0;
  if(n==0)return;

  a.x=(2*p1.x+1*p2.x)/3;
  a.y=(2*p1.y+1*p2.y)/3;
  b.x=(1*p1.x+2*p2.x)/3;
  b.y=(1*p1.y+2*p2.y)/3;
  c.x=(b.x-a.x)*cos(th)-(b.y-a.y)*sin(th)+a.x;
  c.y=(b.x-a.x)*sin(th)+(b.y-a.y)*cos(th)+a.y;
  
  kock(n-1,p1,a);
  printf("%.8f %.8f\n",a.x,a.y);
  kock(n-1,a,c);
  printf("%.8f %.8f\n",c.x,c.y);
  kock(n-1,c,b);
  printf("%.8f %.8f\n",b.x,b.y);
  kock(n-1,b,p2);
}

