#include <cmath>
#include <iomanip>
#include <iostream>

struct Point {
  double x, y;

  void print() { std::cout << std::fixed<< std::setprecision(8) << x << " " << y << std::endl; }
};

void kock(int n, Point p1, Point p2) {
  if (n <= 0)
    return;

  Point s{(2 * p1.x + p2.x) / 3.0, (2 * p1.y + p2.y) / 3.0};
  Point t{(p1.x + 2 * p2.x) / 3.0, (p1.y + 2 * p2.y) / 3.0};
  Point u{(t.x - s.x) * cos(M_PI / 3.0) - (t.y - s.y) * sin(M_PI / 3.0) + s.x,
          (t.x - s.x) * sin(M_PI / 3.0) + (t.y - s.y) * cos(M_PI / 3.0) + s.y};

  kock(n - 1, p1, s);
  s.print();
  kock(n - 1, s, u);
  u.print();
  kock(n - 1, u, t);
  t.print();
  kock(n - 1, t, p2);
}

int main() {
  int n;
  std::cin >> n;

  Point p1{0.0, 0.0};
  Point p2{100.0, 0.0};

  p1.print();
  kock(n, p1, p2);
  p2.print();
}

