#include<stdio.h>
#include<math.h>
#include<stdlib.h>
 
typedef struct Eachtop {
  double x;
  double y;
  struct Eachtop *n;
} Top;
 
Top *tenode, *lnode, *tnode;
 
void makenewpoint(Top* a, Top* b){
  Top *fnode, *snode, *thnode;
  fnode = (Top*)malloc(sizeof(Top));
  fnode->x = (b->x - a->x)/ 3.0+a->x;
  fnode->y = (b->y - a->y)/ 3.0+a->y;
  snode = (Top*)malloc(sizeof(Top));
  snode->x = (b->x - a->x)/ 3.0*2+a->x;
  snode->y = (b->y - a->y)/ 3.0*2+a->y;
  thnode = (Top*)malloc(sizeof(Top));
  thnode->x =1/sqrt(3.0)* ((b->x - a->x) * cos(M_PI/6.0) - (b->y - a->y)*sin(M_PI/6.0)) + a->x;
  thnode->y =1/sqrt(3.0)* ((b->x - a->x) * sin(M_PI/6.0) + (b->y - a->y)*cos(M_PI/6.0)) + a->y;
  a->n = fnode;
  fnode->n = thnode;
  thnode->n = snode;
  snode->n = b;
  tnode = b;
}
int main(void){
  int m, i;
  scanf("%d", &m);
  tenode = NULL;
  lnode = NULL;
  tenode = (Top*)malloc(sizeof(Top));
  tenode->x = 0;
  tenode->y = 0;
  lnode = (Top*)malloc(sizeof(Top));
  lnode->x = 100;
  lnode->y = 0;
  tnode = tenode;
  tenode->n = lnode;
  lnode->n = NULL;
  for(i=0; i<m ;i++){
    tnode = tenode;
    while(tnode != lnode)
      makenewpoint(tnode, tnode->n);
  }
  tnode = tenode;
  while(tnode != NULL){  
    printf("%f %f\n", tnode->x, tnode->y);
    tnode = tnode->n;
  }
  return 0;
}

