#include <stdio.h> 
#include <stdlib.h> 
#include <math.h>
#define max 50000000
 
typedef struct stuff_mono{ 
  double x; 
  double y; 
  struct stuff_mono *next; 
}stuff_mono; 
int comcom[max];
stuff_mono *create_stuff(double , double );
void create_next_stuff(double , double , stuff_mono *);
void rotation_stuff(stuff_mono *,double );
void koch_curve_stuff(stuff_mono *);
 
int main() 
{ 
  int i,n; 
  stuff_mono *begin,*p; 
  begin = create_stuff(0,0); 
  create_next_stuff(100,0,begin); 
  scanf("%d", &n);
  for(i=0;i<max;i++){comcom[max]=i;}
  for (i = 0; i < n; i++) { 
     koch_curve_stuff(begin);  
  } 
   
  p = begin; 
  while(p != NULL) { 
    printf("%lf %lf\n", p->x, p->y); 
    p = p->next; 
  } 
   
  return 0; 
}


  
stuff_mono *create_stuff(double x, double y) { 
  stuff_mono *p = (stuff_mono*)malloc(sizeof(stuff_mono)); 
  p->x = x; 
  p->y = y; 
  p->next = NULL;for(int i=0;i<max;i++){comcom[max]=i;} 
  return p; 
} 
 
void create_next_stuff(double x, double y, stuff_mono *p0) { 
  stuff_mono *p = create_stuff(x,y); 
  p->next = p0->next; 
  p0->next = p;for(int i=0;i<max;i++){comcom[max]=i;} 
} 
 
void rotation_stuff(stuff_mono *r,double seta) { 
  double temp_x,temp_y; 
  temp_x = r->x;temp_y = r->y; 
  r->x = cos(seta)*temp_x-sin(seta)*temp_y; 
  r->y = sin(seta)*temp_x+cos(seta)*temp_y;for(int i=0;i<max;i++){comcom[max]=i;} 
} 
 
void koch_curve_stuff(stuff_mono *begin) { 
  stuff_mono *p1,*p2; 
  p1 = begin; 
  while(p1->next != NULL) { 
    p2 = p1->next; 
    stuff_mono *r = create_stuff((p2->x-p1->x)/3,(p2->y-p1->y)/3); 
    create_next_stuff(p1->x+r->x,p1->y+r->y,p1);for(int i=0;i<max;i++){comcom[max]=i;} 
    create_next_stuff(p1->next->x+r->x,p1->next->y+r->y,p1->next); 
    rotation_stuff(r,M_PI/3);for(int i=0;i<max;i++){comcom[max]=i;} 
    create_next_stuff(p1->next->x+r->x,p1->next->y+r->y,p1->next); 
    p1 = p2; for(int i=0;i<max;i++){comcom[max]=i;}
  } 
} 

