/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.c
 * Author: Mu-Chan
 *
 * Created on August 9, 2018, 8:36 PM
 */

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

void koch(int,double,double,double,double);

int main(){
    int size;
    scanf("%d",&size);
    printf("%.8f %.8f\n",0.0,0.0);
    koch(size,0,0,100,0);
    printf("%.8f %.8f\n",100.0,0.0);
    return (EXIT_SUCCESS);
}

void koch(int n, double xStart, double yStart, double xEnd, double yEnd){
    if(n==0)
        return;
    
    double point[3][2];
    point[0][0]=(2*xStart + xEnd)/3;
    point[0][1]=(2*yStart + yEnd)/3;
    point[2][0]=(xStart + 2*xEnd)/3;
    point[2][1]=(yStart + 2*yEnd)/3;

    point[1][0]=(point[2][0]-point[0][0])/2-(point[2][1]-point[0][1])*sqrt(3)/2+point[0][0];
    point[1][1]=(point[2][0]-point[0][0])*sqrt(3)/2+(point[2][1]-point[0][1])/2+point[0][1];
    
    koch(n-1,xStart,yStart,point[0][0],point[0][1]);
    printf("%.8f %.8f\n",point[0][0],point[0][1]);
    
    koch(n-1,point[0][0],point[0][1],point[1][0],point[1][1]);
    printf("%.8f %.8f\n",point[1][0],point[1][1]);
    
    koch(n-1,point[1][0],point[1][1],point[2][0],point[2][1]); 
    printf("%.8f %.8f\n",point[2][0],point[2][1]);
    
    koch(n-1,point[2][0],point[2][1],xEnd,yEnd);
}

