#include<stdio.h>
#include<math.h>
typedef struct{
  double x;
  double y;
}p;
void kochcurve(int n,p value1,p value2){
  p a,b,c;
  double th=M_PI*60/180;
  if(n==0)return;

  a.x=(2.0*value1.x + 1.0*value2.x)/3.0;
  a.y=(2.0*value1.y + 1.0*value2.y)/3.0;
  b.x=(1.0*value1.x + 2.0*value2.x)/3.0;
  b.y=(1.0*value1.y + 2.0*value2.y)/3.0;
  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;
  kochcurve(n-1,value1,a);
  printf("%.8f %.8f\n",a.x,a.y);
  kochcurve(n-1,a,c);
  printf("%.8f %.8f\n",c.x,c.y);
  kochcurve(n-1,c,b);
  printf("%.8f %.8f\n",b.x,b.y);
  kochcurve(n-1,b,value2);
}
int main(){
  p value1,value2;
  int n;

  scanf("%d",&n);
  value1.x=0;
  value1.y=0;
  value2.x=100;
  value2.y=0;
  printf("%.8f %.8f\n",value1.x,value1.y);
  kochcurve(n,value1,value2);
  printf("%.8f %.8f\n",value2.x,value2.y);
  return 0;
}

