#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <complex>
using namespace std;
using Point = complex<double>;
const double th = acos(-1) / 3;

void koch(int n, Point a, Point b) {
    if (n == 0) {
        cout << b.real() << " " << b.imag() << endl;
        return ;
    }
    Point s = (a * 2.0 + b) / 3.0, t = (a + b * 2.0) / 3.0;
    Point u = (t - s) * Point(cos(th), sin(th)) + s;
    koch(n - 1, a, s);
    koch(n - 1, s, u);
    koch(n - 1, u, t);
    koch(n - 1, t, b);
}

#include <iomanip>
int main() {
    cout << fixed << setprecision(8);
    int n; cin >> n;

    Point a(0, 0), b(100, 0);
    cout << a.real() << " " << a.imag() << endl;
    koch(n, a, b);

    return 0;
}
