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

typedef struct Tyouten{
  double x;
  double y;
  struct Tyouten *next;
}Tn;

Tn *an, *bn, *cn;

void Ball(Tn* p,Tn* q){
  Tn *xn, *yn, *zn;
  xn=(Tn*)malloc(sizeof(Tn));
  xn->x=(q->x - p->x)/3.0+p->x;
  xn->y=(q->y - p->y)/3.0+p->y;
  yn=(Tn*)malloc(sizeof(Tn));
  yn->x=(q->x - p->x)/3.0*2+p->x;
  yn->y=(q->y - p->y)/3.0*2+p->y;
  zn=(Tn*)malloc(sizeof(Tn));
  zn->x=1/sqrt(3.0)* ((q->x - p->x) * cos(M_PI/6.0)-(q->y - p->y)*sin(M_PI/6.0))+p->x;
  zn->y=1/sqrt(3.0)* ((q->x - p->x) * sin(M_PI/6.0)+(q->y - p->y)*cos(M_PI/6.0))+p->y;
  p->next=xn;
  xn->next=zn;
  zn->next=yn;
  yn->next=q;
  cn=q;
}

int main(void){
  int i,n;
  scanf("%d",&n);

  an=NULL;
  bn=NULL;
  an=(Tn*)malloc(sizeof(Tn));
  an->x=0;
  an->y=0;
  bn=(Tn*)malloc(sizeof(Tn));
  bn->x=100;
  bn->y=0;
  cn=an;
  an->next=bn;
  bn->next=NULL;

  for(i=0;i<n;i++){
    cn=an;
    while(cn!=bn)
      Ball(cn,cn->next);
  }
  cn=an;
  while(cn!=NULL){
    printf("%.8f %.8f\n",cn->x,cn->y);
    cn=cn->next;
  }
  return 0;
}

