#include<stdio.h>
#include<math.h>
#define PI 3.141592653589
double th = 60*PI/180;
void fanction(int n,double p1[],double p2[]){
  double s[2],u[2],t[2];

  s[0]=(2*p1[0]+p2[0])/3;
  s[1]=(2*p1[1]+p2[1])/3;
  t[0]=(p1[0]+2*p2[0])/3;
  t[1]=(p1[1]+2*p2[1])/3;
  u[0]=(t[0]-s[0])*cos(th)-(t[1]-s[1])*sin(th)+s[0];
  u[1]=(t[0]-s[0])*sin(th)+(t[1]-s[1])*cos(th)+s[1];
  if(n==1){

    printf("%lf %lf\n",s[0],s[1]);
    printf("%lf %lf\n",u[0],u[1]);
    printf("%lf %lf\n",t[0],t[1]);
    printf("%lf %lf\n",p2[0],p2[1]);

    return;
  }

  fanction(n-1,p1,s);
  fanction(n-1,s,u);
  fanction(n-1,u,t);
  fanction(n-1,t,p2);
}

int main(void){
  int n;
  double p1[2],p2[2];
  scanf("%d",&n);
  p1[0]=0;
  p1[1]=0;
  p2[0]=100;
  p2[1]=0;
  printf("%lf %lf\n",p1[0],p1[1]);
  fanction(n,p1,p2);

  return 0;
}