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

typedef struct {
  double x,y;
} P;

void print(P p) {
  printf("%f %f\n", p.x, p.y);
}

double deg = M_PI / 3;

void kock(int n, P p1, P p2) {
  if(!n) return;
  P s = {(2 * p1.x + 1 * p2.x) / 3,
	 (2 * p1.y + 1 * p2.y) / 3};
  P t = {(1 * p1.x + 2 * p2.x) / 3,
	 (1 * p1.y + 2 * p2.y) / 3};
  P u = {(t.x - s.x) * cos(deg) - (t.y - s.y) * sin(deg) + s.x,
	 (t.x - s.x) * sin(deg) - (t.y - s.y) * cos(deg) + t.y};
  kock(n - 1, p1, s);
  print(s);
  kock(n - 1, s, u);
  print(u);
  kock(n - 1, u, t);
  print(t);
  kock(n - 1, t, p2);
}

int main() {
  int n;
  P p1 = {0, 0}, p2 = {100, 0};
  scanf("%d", &n);
  print(p1);
  kock(n, p1, p2);
  print(p2);
  return 0;
}

