#include <stdio.h>
#include <math.h>
void kock(int n,double x1,double y1,double x2,double y2) {
  double sx,sy,ux,uy,tx,ty;
  if(n != 0) {
  sx = (2 * x1 + x2) / 3;
  sy = (2 * y1 + y2) / 3;
  
  tx = (x1 + 2 * x2) / 3;
  ty = (x1 + 2 * y2) / 3;
  
  ux = ((tx - sx) * cos(M_PI/3) - (ty - sy) * sin(M_PI/3)) + sx;
  uy = ((tx - sx) * sin(M_PI/3) + (ty - sy) * cos(M_PI/3)) + sy;
  
  kock(n-1, x1,y1,sx, sy);
  printf("%f %f\n",sx,sy);
  kock(n-1, sx,sy,ux,uy);
  printf("%f %f\n",ux,uy);
  kock(n-1, ux,uy,tx,ty);
  printf("%f %f\n",tx,ty);
  kock(n-1, tx,ty,x2,y2);
  }

}


int main() {
  int n,k;
  double x1 = 0.0,x2 = 100.0,y1 =0.0,y2 = 0.0;
  scanf("%d",&n);
  printf("%f %f\n",x1,y1);
  kock(n,x1,y1,x2,y2);
  printf("%f %f\n",x2,y2);
  return 0;
}