#include<stdio.h>
#include<math.h>

struct Point {
double x,y;
};

void koch(int, Point a1,Point a2);

int main()
{
    Point a1,a2;
    int n;
    
    scanf("%d",&n);
    
    a1.x =0;
    a1.y =0;
    a2.x =100;
    a2.y =0;
    


printf("%.8f %.8f\n",a1.x,a2.y);
    koch(n,a1,a2);
    
    printf("%.8f %.8f\n",a2.x ,a2.y);
    
    return 0;
}

void koch(int n, Point a1 ,Point a2)
{
    double razian;
    if(n==0)return 0;
    Point s, t, u;

s.x = (2.0*a1.x + 1.0*a2.x) / 3.0;
s.y = (2.0*a1.y + 1.0*a2.y) / 3.0;
t.x = (1.0*a1.x + 2.0*a2.x) / 3.0;
t.y = (1.0*a1.y + 2.0*a2.y) / 3.0;
u.x=(t.x -s.x)* cos(razian) - (t.x -s.x)* sin(razian)+ s.x;
u.x=(t.x -s.x)* sin(razian) + (t.x -s.x)* cos(razian)+ s.x;

koch(n-1,a, s);
    printf("%.8f %.8f\n",s.x ,s.y);
koch(n-1,s, u);
    printf("%.8f %.8f\n",u.x ,u.y);
koch(n-1,u, t);
    printf("%.8f %.8f\n",t.x ,t.y);
koch(n-1,t,a2);
}