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

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

void kock(int n, point_t ps, point_t pe) {
  if (n == 0)
    return;

  // (n:+p:p) = 0:0:2, 1:3:5, 2:12:17, 3:48:65
  // +p(n) = (p(n-1) - 1) * 3
  // p(n) = +p(n) + p(n-1)

  // calculate {s, t, u}
  double rad = 60 * M_PI / 180.0;
  point_t s, t, u;
  s.x = (2 * ps.x + 1 * pe.x) / 3;
  s.y = (2 * ps.y + 1 * pe.y) / 3;
  t.x = (1 * ps.x + 2 * pe.x) / 3;
  t.y = (1 * ps.y + 2 * pe.y) / 3;
  u.x = (t.x - s.x) * cos(rad) - (t.y - s.y) * sin(rad) + s.x;
  u.y = (t.x - s.x) * sin(rad) + (t.y - s.y) * cos(rad) + s.y;
  
  kock(n - 1, ps, s);
  printf ("%.8lf %.8lf\n", s.x, s.y);
  kock(n - 1, s, u);
  printf ("%.8lf %.8lf\n", u.x, u.y);
  kock(n - 1, u, t);
  printf ("%.8lf %.8lf\n", t.x, t.y);
  kock(n - 1, t, pe);
}

int main(void){
  int n;
  point_t ps = {0, 0}, pe = {100, 0};
  
  scanf("%d", &n);
  printf("%.8lf %.8lf\n", ps.x, ps.y);
  kock(n, ps, pe);
  printf("%.8lf %.8lf\n", pe.x, pe.y);

  return 0;
}