#include <bits/stdc++.h>
using namespace std;

template <class T>
class Vector2 {
 public:
  T x;
  T y;

  Vector2(T init_x, T init_y) : x(init_x), y(init_y){};

  Vector2 &operator+=(const Vector2 &B) {
    x += B.x;
    y += B.y;
    return (*this);
  }

  Vector2 &operator-=(const Vector2 &B) {
    x -= B.x;
    y -= B.y;
    return (*this);
  }

  Vector2 &operator*=(const T &value) {
    x *= value;
    y *= value;
    return (*this);
  }

  Vector2 &operator/=(const T &value) {
    x /= value;
    y /= value;
    return (*this);
  }

  Vector2 operator+(const Vector2 &B) const { return Vector2(*this) += B; }
  Vector2 operator-(const Vector2 &B) const { return Vector2(*this) -= B; }

  Vector2 operator+(const T &value) const {
    return Vector2(x + value, y + value);
  }
  Vector2 operator-(const T &value) const {
    return Vector2(x - value, y - value);
  }

  Vector2 operator*(const T &value) const { return Vector2(*this) *= value; }
  Vector2 operator/(const T &value) const { return Vector2(*this) /= value; }

  void rotate(const double &angle) {
    T temp_x = x * cos(angle) - y * sin(angle);
    y = x * sin(angle) + y * cos(angle);
    x = temp_x;
  }
};

template <class T>
const Vector2<T> operator+(const T &value, const Vector2<T> &A) {
  return Vector2<T>(value + A.x, value + A.y);
}

template <class T>
const Vector2<T> operator-(const T &value, const Vector2<T> &A) {
  return Vector2<T>(value - A.x, value - A.y);
}

template <class T>
const Vector2<T> operator*(const T &value, const Vector2<T> &A) {
  return Vector2<T>(value * A.x, value * A.y);
}

template <class T>
const Vector2<T> operator/(const T &value, const Vector2<T> &A) {
  return Vector2<T>(value / A.x, value / A.y);
}

double lerp(const double &a, const double &b, const double &f) {
  return (a * (1.0 - f)) + (b * f);
}

Vector2<double> lerp(const Vector2<double> &a, const Vector2<double> &b,
                     const double &f) {
  double x = lerp(a.x, b.x, f);
  double y = lerp(a.y, b.y, f);
  return Vector2<double>(x, y);
}

int main() {
  int n;
  cin >> n;
  vector<Vector2<double> > points;
  Vector2<double> p_first(0.0, 0.0);
  points.push_back(p_first);
  Vector2<double> p_end(100.0, 0.0);
  points.push_back(p_end);

  vector<Vector2<double> >::iterator it;
  for (int i = 0; i < n; i++) {
    it = points.begin();
    while (it + 1 != points.end()) {
      Vector2<double> left = *it;
      it++;
      Vector2<double> right = *it;
      Vector2<double> p0 = lerp(left, right, 1.0 / 3.0);
      it = points.insert(it, p0);
      it++;
      Vector2<double> base = right - left;
      base.rotate(M_PI / 2.0);
      Vector2<double> p1 = (left + right) / 2.0 + base * sqrt(3.0) / 6.0;
      it = points.insert(it, p1);
      it++;
      Vector2<double> p2 = lerp(left, right, 2.0 / 3.0);
      it = points.insert(it, p2);
      it++;
    }
  }

  for (it = points.begin(); it != points.end(); it++) {
    printf("%1.8f %1.8f\n", (*it).x, (*it).y);
  }
  return 0;
}

// typedef pair<double, double> Point;

// double lerp(const double& a, const double& b, const double& f) {
//   return (a * (1.0 - f)) + (b * f);
// }

// Point lerp(const Point& a, const Point& b, const double& f) {
//   double x = lerp(a.first, b.first, f);
//   double y = lerp(a.second, b.second, f);
//   return Point(x, y);
// }

// Point rotate(const Point& p, double angle) {
//   return Point(p.first * cos(angle) - p.second * sin(angle),
//                p.first * sin(angle) + p.second * cos(angle));
// }

// Point calc(const Point& left, const Point& right) {
//   Point rot_base(right.first - left.first, right.second - left.second);
//   Point RotatedPoint = rotate(rot_base, M_PI / 2.0);
//   double first =
//       (left.first + right.first) / 2.0 + RotatedPoint.first * sqrt(3.0)
//       / 6.0;
//   double second = (left.second + right.second) / 2.0 +
//                   RotatedPoint.second * sqrt(3.0) / 6.0;
//   return Point(first, second);
// }

// int main() {
//   int n;
//   cin >> n;
//   vector<Point> points;
//   Point p_first(0.0, 0.0);
//   points.push_back(p_first);
//   Point p_end(100.0, 0.0);
//   points.push_back(p_end);

//   vector<Point>::iterator it;
//   for (int i = 0; i < n; i++) {
//     it = points.begin();
//     while (it + 1 != points.end()) {
//       Point left = *it;
//       it++;
//       Point right = *it;
//       Point p0 = lerp(left, right, 1.0 / 3.0);
//       it = points.insert(it, p0);
//       it++;
//       Point p1 = calc(left, right);
//       it = points.insert(it, p1);
//       it++;
//       Point p2 = lerp(left, right, 2.0 / 3.0);
//       it = points.insert(it, p2);
//       it++;
//     }
//   }

//   for (it = points.begin(); it != points.end(); it++) {
//     printf("%1.8f %1.8f\n", (*it).first, (*it).second);
//   }
//   return 0;
// }


Measured memory_bytes: 3252