#include <stdio.h>
#include <math.h>
int koch(double px1,double py1,double px2,double py2,int n);
int main(){
  int n;
  double px1=0.0,py1=0.0;
  double px2=100.0,py2=0.0;
  scanf("%d",&n);
  printf("0.00000000 0.00000000\n");
  koch(px1,py1,px2,py2,n);
  return 0;
}
int koch(double px1,double py1,double px2,double py2,int n){
  if(n==0){
    printf("%f %f\n",px2,py2);
    return 0;
  }
  double Sx,Sy,Tx,Ty,Ux,Uy;
  Sx=(px2-px1)/3+px1;
  Sy=(py2-py1)/3+py1;
  Tx=(px2-px1)*2/3+px1;
  Ty=(py2-py1)*2/3+py1;
  Ux=(cos(M_PI/3)*(Tx-Sx)-sin(M_PI/3)*(Ty-Sy))+Sx;
  Uy=(sin(M_PI/3)*(Tx-Sx)+cos(M_PI/3)*(Ty-Sy))+Sy;
  koch(px1, py1, Sx, Sy, n-1);
  koch(Sx, Sy, Ux, Uy, n-1);
  koch(Ux, Uy, Tx, Ty, n-1);
  koch(Tx, Ty, px2, py2, n-1);
   
}