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

#define pai 3.14159265358979323846264338327950288

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

void kock(int,XY,XY);

int main(){
  int n;
  XY p1={0.0,0.0};
  XY p2={100.0,0.0};

  scanf("%d",&n);

  printf("%.8f %.8f\n",p1.x,p1.y);
  
  kock(n,p1,p2);
  
  printf("%.8f %.8f\n",p2.x,p2.y);

  return 0;
}

void kock(int n,XY p1,XY p2){
  XY s,t,u;
  
    if(n==0)return;

    s.x = (double)((double)2*p1.x + (double)1*p2.x)/(double)3;
    s.y = (double)((double)2*p1.y + (double)1*p2.y)/(double)3;
    t.x = (double)((double)1*p1.x + (double)2*p2.x)/(double)3;
    t.y = (double)((double)1*p1.y + (double)2*p2.y)/(double)3;
    u.x = (double)(t.x - s.x)*cos(pai/(double)3) - (double)(t.y - s.y)*sin(pai/(double)3) + s.x;
    u.y = (double)(t.x - s.x)*sin(pai/(double)3) + (double)(t.y - s.y)*cos(pai/(double)3) + s.y;

    kock(n-1,p1,s);

    printf("%.8f %.8f\n",s.x,s.y);

    kock(n-1,s,u);

    printf("%.8f %.8f\n",u.x,u.y);

    kock(n-1,u,t);

    printf("%.8f %.8f\n",t.x,t.y);

    kock(n-1,t,p2);
}

