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

void Kock(int, double, double, double, double);

int main(){

  int n;

  scanf("%d", &n);

  printf("%.8f %.8f\n", 0,0, 0,0);
  
  Kock(n, 0, 0, 100, 0);
 
  printf("%.8f %.8f\n", 100.0, 0.0);

  return 0;

}

void Kock(int n, double p1x, double p1y, double p2x, double p2y){
  
  double sx, sy, ux, uy, tx, ty;

  if(n == 0)
    return;

  sx = (2 * p1x + p2x) / 3;

  sy = (2 * p1y + p2y) / 3;

  tx = (p1x + 2 * p2x) / 3;

  ty = (p1y + 2 * p2y) / 3;

  ux = (tx - sx) * (1/(double)2) - (ty - sy) * (sqrt(3)/2) + sx;

  uy = (tx - sx) * (sqrt(3)/2) + (ty - sy) * (1/(double)2) + sy;
  

  Kock((n - 1), p1x, p1y, sx, sy);
  
  printf("%.8f %.8f\n", sx, sy);

  Kock((n - 1), sx, sy, ux, uy);

  printf("%.8f %.8f\n", ux, uy);

  Kock((n - 1), ux, uy, tx, ty);

  printf("%.8f %.8f\n", tx, ty);

  Kock((n - 1), tx, ty, p2x, p2y);
  
}