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

void kock(int n, double p1x, double p1y, double p2x, double p2y);

int main(void)
{
  int n;
  double p1x = 0, p1y = 0, p2x = 100, p2y = 0;
  scanf("%d", &n);
  printf("%f %f\n", p1x, p1y);
  kock(n, p1x, p1y, p2x, p2y);
  printf("%f %f\n", p2x, p2y);

  return 0;
}

void kock(int n, double p1x, double p1y, double p2x, double p2y)
{
  double sx, sy, tx, ty, ux, uy, rad = M_PI/3;
  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)*cos(rad) - (ty - sy)*sin(rad) + sx;
  uy = (tx - sx)*sin(rad) + (ty - sy)*cos(rad) + sy;

  kock(n - 1, p1x, p1y, 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, p2x, p2y);
}