#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;

int n;

//計算部分
double dit(pair<double,double>x, pair<double,double> y){
    return sqrt(pow(x.first - y.first, 2) + pow(x.second - y.second, 2));
}

void koch(int cnt, pair<double,double>a, pair<double,double> b){
    if(n == cnt) return;

    pair<double,double> s,t,u;

    if(a.first < b.first && a.second == b.second){
        s = make_pair(a.first+((b.first-a.first)/3), a.second);
        u = make_pair(b.first-((b.first-a.first)/3),b.second);
        double l = dit(s,u);
        t = make_pair(s.first+(l/2),s.second+l*sin(M_PI/3));
    }
    else if(a.first < b.first && a.second < b.second){
        s = make_pair(a.first+((b.first-a.first)/3), a.second+((b.second-a.second)/3));
        u = make_pair(b.first-((b.first-a.first)/3),b.second-((b.second-a.second)/3));
        t = make_pair(u.first-dit(s,u),u.second);
    }
    else if(a.first > b.first && a.second < b.second){
        s = make_pair(a.first-((a.first-b.first)/3), a.second+((b.second-a.second)/3));
        u = make_pair(b.first+((a.first-b.first)/3),b.second-((b.second-a.second)/3));
        t = make_pair(s.first - dit(s,u),s.second);
    }
    else if(a.first > b.first && a.second == b.second){
        s = make_pair(a.first-((a.first-b.first)/3), a.second);
        u = make_pair(b.first+((a.first-b.first)/3),b.second);
        double l  = dit(s,u);
        t = make_pair(s.first - (l/2),s.second-(l*sin(M_PI/3)));
        }
    else if(a.first > b.first && a.second > b.second){
        s = make_pair(a.first-((a.first-b.first)/3), a.second-((a.second-b.second)/3));
        u = make_pair(b.first+((a.first-b.first)/3),b.second+((a.second-b.second)/3));
        t = make_pair(u.first + dit(s,u),u.second);
    }
    else{
        s = make_pair(a.first+((b.first-a.first)/3), a.second-((a.second-b.second)/3));
        u = make_pair(b.first-((b.first-a.first)/3),b.second+((a.second-b.second)/3));
        t = make_pair(s.first + dit(s,u),s.second);
    }
    
    koch(cnt+1,a,s);
    // cout << fixed << setprecision(8)<< s.first << " " << s.second << endl;
    cout << s.first << " " << s.second << endl;
    koch(cnt+1,s,t);
    // cout << fixed << setprecision(8)<< t.first << " " << t.second << endl;
    cout << t.first << " " << t.second << endl;
    koch(cnt+1,t,u);
    // cout << fixed << setprecision(8)<< u.first << " " << u.second << endl;
    cout << u.first << " " << u.second << endl;
    koch(cnt+1,u,b);
}


int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n;
    pair<double,double> start,end;
    start=make_pair(0,0);
    end=make_pair(100,0);
    // cout << fixed << setprecision(8)<< start.first << " " << start.second << endl;
    cout << start.first << " " << start.second << endl;
    koch(0,start,end);
    // cout << fixed << setprecision(8)<< end.first << " " << end.second << endl;
    cout << end.first << " " << end.second << endl;

    return 0;
}


Measured memory_bytes: 3312