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

#define X 0
#define Y 1
void kock(int n,double p1[2],double p2[2])
{
  if(n==0)return;
  double s[2],t[2],u[2],cs,sn;
  s[X]=(2.0*p1[X]+p2[X])/3.0;
  s[Y]=(2.0*p1[Y]+p2[Y])/3.0;
  t[X]=(p1[X]+2.0*p2[X])/3.0;
  t[Y]=(p1[Y]+2.0*p2[Y])/3.0;
  sn=sqrt(3)/2.0;
  cs=1.0/2.0;
  u[X]=(t[X]-s[X])*cs-(t[Y]-s[Y])*sn+s[X];
  u[Y]=(t[X]-s[X])*sn+(t[Y]-s[Y])*cs+s[Y];

  kock(n-1,p1,s);
  printf("%f %f\n",s[X],s[Y]);
  kock(n-1,s,u);
  printf("%f %f\n",u[X],u[Y]);
  kock(n-1,u,t);
  printf("%f %f\n",t[X],t[Y]);
  kock(n-1,t,p2);
}
int main()
{
  int n;
  double p1[2]={0,0},p2[2]={100,0};
  scanf("%d",&n);
  printf("%f %f\n",p1[X],p1[Y]);
  kock(n,p1,p2);
  printf("%f %f\n",p2[X],p2[Y]);
  return 0;
}

