#include <stdio.h>
#include <math.h>
#define Ze 0
#define On 1
#define Tw 2
#define Th 3
#define Tho 100
#define M_PI 3.14159265358979

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

void kock(int,point,point);

void kock(int n,point p1,point p2)
{
    if(n == Ze) return;
    point s,t,u;
    
    s.x = (Tw*p1.x+On*p2.x)/Th;
    s.y = (Tw*p1.y+On*p2.y)/Th;
    t.x = (On*p1.x+Tw*p2.x)/Th;
    t.y = (On*p1.y+Tw*p2.y)/Th;
    u.x = (t.x-s.x)*cos(60 * M_PI/180.0)-(t.y-s.y)*sin(60 * M_PI/180.0)+s.x;
    u.y = (t.x-s.x)*sin(60 * M_PI/180.0)+(t.y-s.y)*cos(60 * M_PI/180.0)+s.y;
    
    
    kock(n-1, p1, s);
    //print s;
    printf("%.8f %.8f\n",s.x,s.y);
    kock(n-1, s, u);
   // print u;
    printf("%.8f %.8f\n",u.x,u.y);
    kock(n-1, u, t);
    //print t;
    printf("%.8f %.8f\n",t.x,t.y);
    kock(n-1, t, p2);
    return;
}

int main(){
    int n;
    scanf("%d",&n);
    point p1,p2;
    p1.x = Ze;
    p1.y = Ze;
    p2.x = Tho;
    p2.y = Ze;
    printf("%.8f %.8f\n",p1.x,p1.y);
    kock(n,p1,p2);
    printf("%.8f %.8f\n",p2.x,p2.y);
    return Ze;
}
