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

#define PI 3.141592
typedef struct {
  double x;
  double y;
} xy_t;

void koch(int n, xy_t* p1_p, xy_t* p2_p){
  xy_t s={0} ,t={0} ,u={0};
  double rad;
if( n == 0 ){
  return;
}

// internally dividing point
  s.x = ( 2*(p1_p->x) + 1*(p2_p->x) )/(1+2);
  s.y = ( 2*(p1_p->y) + 1*(p2_p->y) )/(1+2);
  t.x = ( 1*(p1_p->x) + 2*(p2_p->x) )/(2+1);
  t.y = ( 1*(p1_p->y) + 2*(p2_p->y) )/(2+1);
// http://imagingsolution.blog107.fc2.com/blog-entry-111.html
  rad = 60 * PI / 180;
  u.x = t.x*cos(rad) - t.y*sin(rad) + s.x - s.x*cos(rad) + s.y*sin(rad); 
  u.y = t.x*sin(rad) + t.y*cos(rad) + s.y - s.x*sin(rad) - s.y*cos(rad);

  koch(n-1 ,p1_p ,&s);
  printf("%f %f\n" ,s.x ,s.y );
  koch(n-1 ,&s ,&u);
  printf("%f %f\n" ,u.x ,u.y );
  koch(n-1 ,&u ,&t);
  printf("%f %f\n" ,t.x ,t.y );
  koch(n-1 ,&t ,p2_p);

}

int main(){ 
  int i,j;
  int n;
  xy_t p1, p2;
  p1.x = 0;   p1.y = 0;
  p2.x = 100;  p2.y = 0;

  scanf("%d", &n);

  printf("%f %f\n" ,p1.x ,p1.y );
  koch( n, &p1, &p2);
  printf("%f %f\n" ,p2.x ,p2.y );
  
  return 0; // Don't forget return 0
}