#include<stdio.h>
#include<math.h>
#define PI 3.14159265358979323846

void Koch(int,double,double,double,double);
int main(){
  int n;
  double x1=0,y1=0,x2=100,y2=0;
  scanf("%d",&n);
  printf("%.8lf %.8lf\n",x1,y1);
  if(n>0)Koch(n,x1,y1,x2,y2);
  printf("%.8lf %.8lf\n",x2,y2);
  return 0;
}
void Koch(int n,double x1,double y1,double x2,double y2){
  n--;
  double x,y;
  x=((x2-x1)/3)*cos(PI/3)-((y2-y1)/3)*sin(PI/3)+(x2-x1)/3+x1;
  y=((x2-x1)/3)*sin(PI/3)+((y2-y1)/3)*cos(PI/3)+(y2-y1)/3+y1;
  
  if(n>0)Koch(n,x1,y1,(x2-x1)/3+x1,(y2-y1)/3+y1);

  printf("%.8lf %.8lf\n",(x2-x1)/3+x1,(y2-y1)/3+y1);

  if(n>0)Koch(n,(x2-x1)/3+x1,(y2-y1)/3+y1,x,y);

  printf("%.8lf %.8lf\n",x,y);

  if(n>0)Koch(n,x,y,(x2-x1)/3*2+x1,(y2-y1)/3*2+y1);

  printf("%.8lf %.8lf\n",(x2-x1)/3*2+x1,(y2-y1)/3*2+y1);

  if(n>0)Koch(n,(x2-x1)/3*2+x1,(y2-y1)/3*2+y1,x2,y2);
}
