import std.stdio, std.string, std.conv;

struct Point {
    double x, y;
}

void koch(int n, Point a, Point b) {
    import std.math;
    if (n == 0) return;
    double th = PI * 60.0 / 180.0;
    Point s = Point((2.0 * a.x + 1.0 * b.x) / 3.0, (2.0 * a.y + 1.0 * b.y) / 3.0);
    Point t = Point((1.0 * a.x + 2.0 * b.x) / 3.0, (1.0 * a.y + 2.0 * b.y) / 3.0);
    Point u = Point((t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x, (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y);
    koch(n-1, a, s);
    writefln("%.8f %.8f", s.x, s.y);
    koch(n-1, s, u);
    writefln("%.8f %.8f", u.x, u.y);
    koch(n-1, u, t);
    writefln("%.8f %.8f", t.x, t.y);
    koch(n-1, t, b);
}

void main() {
    int n = readln.chomp.to!int;
    Point a = Point(0.0, 0.0);
    Point b = Point(100.0, 0);
    writefln("%.8f %.8f", a.x, a.y);
    koch(n, a, b);
    writefln("%.8f %.8f", b.x, b.y);
}
