/*
 * FileName:     koch_curve_fix
 * CreatedDate:  2020-06-11 22:24:37 +0900
 * LastModified: 2020-06-11 23:14:12 +0900
 */

#include <stdio.h>
void koch_curve(double *left,double *right,int i,int n){
    if(i==n){
        return ;
    }
    double left_next[]={2.0*(left[0])/3.0+right[0]/3.0,2.0*(left[1])/3.0+right[1]/3.0};
    double right_next[]={left[0]/3.0+2.0*right[0]/3.0,(left[1])/3.0+2.0*right[1]/3.0};
    double new_node[]={(right_next[0]-left_next[0]-1.73205081*(right_next[1]-left_next[1]))/2.0+left_next[0],(1.73205081*(right_next[0]-left_next[0])+right_next[1]-left_next[1])/2.0+left_next[1]};
    koch_curve(left,left_next,i+1,n);
    printf("%lf %lf\n",left_next[0],left_next[1]);
    koch_curve(left_next,new_node,i+1,n);
    printf("%lf %lf\n",new_node[0],new_node[1]);
    koch_curve(new_node,right_next,i+1,n);
    printf("%lf %lf\n",right_next[0],right_next[1]);
    koch_curve(right_next,right,i+1,n);
}

int main(void){
    int n;scanf("%d",&n);
    double left[]={0,0},right[]={100.0,0};
    printf("%lf %lf\n",left[0],left[1]);
    koch_curve(left,right,0,n);
    printf("%lf %lf\n",right[0],right[1]);
    return 0;
}

