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

int get_uint() {
  int n = 0;
  int c = getchar_unlocked();
  if(c < 48 || 57 < c) return c;
  while(47 < c && c < 58) {
    n = 10 * n + (c & 0xf);
    c = getchar_unlocked();
  }
  return n;
}
typedef struct Point {
  double x;
  double y;
} Point;
void koch(int n, Point left, Point right) {
  if(!n) return;
  Point s, u, t;
  const double THETA = M_PI / 3;
  s.x = (2 * left.x + right.x) / 3;
  s.y = (2 * left.y + right.y) / 3;
  t.x = (2 * right.x + left.x) / 3;
  t.y = (2 * right.y + left.y) / 3;
  u.x = (t.x - s.x) * cos(THETA) - (t.y - s.y) * sin(THETA) + s.x;
  u.y = (t.x - s.x) * sin(THETA) + (t.y - s.y) * cos(THETA) + s.y;
  koch(n-1, left, s);
  printf("%.5lf %.5lf\n", s.x, s.y);
  koch(n-1, s, u);
  printf("%.5lf %.5lf\n", u.x, u.y);
  koch(n-1, u, t);
  printf("%.5lf %.5lf\n", t.x, t.y);
  koch(n-1, t, right);
}
int main(int argc, char **argv) {
  int n = get_uint();
  printf("%.5lf %.5lf\n", 0.0, 0.0);
  koch(n, (Point){0, 0}, (Point){100, 0});
  printf("%.5lf %.5lf\n", 100.0, 0.0);
  return 0;
}

