import std.array, std.stdio, std.conv, std.string, std.math, std.random, std.range,std.functional;
import std.algorithm.searching, std.algorithm.sorting, std.algorithm.iteration, std.algorithm.comparison;


struct Point
{
    double x, y;

    Point opBinary(string op)(Point rhs)
    {
        return mixin("Point(x "~op~" rhs.x, y "~op~" rhs.y)");
    }
    Point opBinary(string op)(double rhs)
    {
        return mixin("Point(x "~op~" rhs, y "~op~" rhs)");
    }
    string toString()
    {
        return format("%f %f", x, y);
    }

}

void main()
{
    int N = readln().strip.to!int;

    void func(int n, Point start, Point goal)
    {
        if(n==0)
        {
            return;
        }
        Point s = start+((goal-start)/3);
        Point t = goal-(goal-start)/3;
        Point u = Point(
            (t.x-s.x)*cos(PI*2/6) - (t.y-s.y)*sin(PI*2/6)+s.x,
            (t.x-s.x)*sin(PI*2/6) + (t.y-s.y)*cos(PI*2/6)+s.y 
        );
        func(n-1, start, s);
        writeln(s);
        func(n-1, s, u);
        writeln(u);
        func(n-1, u, t);
        writeln(t);
        func(n-1, t, goal);
    }
    writeln(Point(0, 0));
    func(N, Point(0, 0), Point(100, 0));
    writeln(Point(100, 0));
}


sizediff_t minIndex(alias pred="a<b", R) (R list)
    if(isForwardRange!R && !isInfinite!R && is(typeof(binaryFun!pred(list.front, list.front))))
{
    assert(!list.empty);
    typeof(list.front) min = list.front;
    sizediff_t minPos;
    sizediff_t curPos;
    for(list.popFront(); !list.empty; list.popFront())
    {
        curPos++;

        if(binaryFun!pred(list.front, min))
        {
            min = list.front;
            minPos = curPos;
        }
    }
    return minPos;
}

