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

typedef struct{
    double x;
    double y;
}point;

double ppp(int n,double leftx,double lefty,double rightx,double righty){
    if(n!=0){
        double temp[3][2];
        temp[0][0]=(2*leftx+rightx)/3;
        temp[0][1]=(2*lefty+righty)/3;
        temp[2][0]=(leftx+2*rightx)/3;
        temp[2][1]=(lefty+2*righty)/3;
        temp[1][0]=(temp[2][0]-temp[0][0])/2-(temp[2][1]-temp[0][1])*sqrt(3)/2+temp[0][0];
        temp[1][1]=(temp[2][0]-temp[0][0])*sqrt(3)/2+(temp[2][1]-temp[0][1])/2+temp[0][1];

        ppp(n-1,leftx,lefty,temp[0][0],temp[0][1]);
        printf("%lf %lf\n",temp[0][0],temp[0][1]);
        ppp(n-1,temp[0][0],temp[0][1],temp[1][0],temp[1][1]);
        printf("%lf %lf\n",temp[1][0],temp[1][1]);
        ppp(n-1,temp[1][0],temp[1][1],temp[2][0],temp[2][1]);
        printf("%lf %lf\n",temp[2][0],temp[2][1]);
        ppp(n-1,temp[2][0],temp[2][1],rightx,righty);
    }
    else return 0;
}

int main(){
    int n;
    scanf("%d",&n);
    point p1, p2;
    p1.x = 0.0;
    p1.y = 0.0;
    p2.x = 100.0;
    p2.y = 0.0;
    printf("%lf %lf\n",p1.x,p1.y);
    ppp(n,p1.x,p1.y,p2.x,p2.y);
    printf("%lf %lf\n",p2.x,p2.y);
    return 0;
}
