#include<stdio.h>
#include<math.h>

typedef struct{
  double x;
  double y;
}point;

void koch(int i, point p1, point p2){
  point a, b, c;
  double change;

  if(i == 0) return;

  change = M_PI * 60.0 / 180.0;
  a.x = (2.0 * p1.x + p2.x) / 3.0;
  a.y = (2.0 * p1.y + p2.y) / 3.0;
  b.x = (p1.x + 2.0 * p2.x) / 3.0;
  b.y = (p1.y + 2.0 * p2.y) / 3.0;
  c.x = (b.x - a.x) * cos(change) - (b.y - a.y) * sin(change) + a.x;
  c.y = (b.x - a.x) * sin(change) + (b.y - a.y) * cos(change) + a.y;

  koch(i-1, p1, a);
  printf("%f %f\n", a.x, a.y);
  koch(i-1, a, c);
  printf("%f %f\n", c.x, c.y);
  koch(i-1, c, b);
  printf("%f %f\n", b.x, b.y);
  koch(i-1, b, p2);
}

int main(){
  int i;
 point p1= {0.0,0.0};
 point p2= {100.0,0.0};

  scanf("%d",&i);

  printf("%.8f %.8f\n",p1.x,p1.y);
  koch(i,p1,p2);
  printf("%.8f %.8f\n",p2.x,p2.y);

  return 0;
}
  

