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

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

int koch(int, point, point);

int num;

int main(){
  point p1, p2;

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;

  scanf("%d" ,&num);

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

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

int koch(int n, point p1, point p2){

  point s, t, u;
  if(n == 0){
    return 0;
  }
  
  s.x = (2*p1.x + p2.x)/3;
  s.y = (2*p1.y + p2.y)/3;
  t.x = (p1.x + 2*p2.x)/3;
  t.y = (p1.y + 2*p2.y)/3;
  u.x = (t.x - s.x)*cos(M_PI/3) - (t.y - s.y) * sin(M_PI/3) + s.x;
  u.y = (t.x - s.x)*sin(M_PI/3) + (t.y - s.y) * cos(M_PI/3) + s.y;
  

  koch(n-1, p1, s);
  printf("%.8f ", s.x);
  printf("%.8f\n", s.y);
  
  koch(n-1, s, u);
  printf("%.8f ", u.x);
  printf("%.8f\n", u.y);
  
  koch(n-1, u, t);
  printf("%.8f ", t.x);
  printf("%.8f\n", t.y);
  
  koch(n-1, t, p2);

}

