#include<stdio.h>
#include<math.h>
#define M_PI 3.141592653589

void koch(int n, double ax, double ay, double bx, double by) {
   if (n == 0) {
     return;
   }

   double sx, sy, tx, ty, ux, uy;
   double th = M_PI * 60.0 / 180.0;

   sx = (2.0*ax + 1.0*bx) / 3.0;
   sy = (2.0*ay + 1.0*by) / 3.0;
   tx = (1.0*ax + 2.0*bx) / 3.0;
   ty = (1.0*ay + 2.0*by) / 3.0;
   ux = (tx - sx)*cos(th) - (ty - sy)*sin(th) + sx;
   uy = (tx - sx)*sin(th) + (ty - sy)*cos(th) + sy;

   koch(n-1, ax, ay, sx, sy);
   printf ("%.8f %.8f\n", sx, sy);

   koch(n-1, sx, sy, ux, uy);
   printf("%.8f %.8f\n", ux, uy);

   koch(n-1, ux, uy, tx, ty);
   printf("%.8f %.8f\n", tx, ty);

   koch(n-1, tx, ty, bx, by);
}

int main () {
   double ax, ay, bx, by;
   int n;

   scanf ("%d", &n);

   ax = 0;
   ay = 0;
   bx = 100;
   by = 0;

   printf("%.8f %.8f\n", ax, ay);
   koch(n, ax, ay, bx, by);
   printf("%.8f %.8f\n", bx, by);

   return 0;
}