#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.141592

typedef struct tuple{
  double x;
  double y;
}Coord;

int drawKoch(int n,Coord p1,Coord p2){
  Coord s,t,u;

  if(n == 0) return 0;  

  // calcurate
  s.x = (p1.x*2 + p2.x) / 3;
  s.y = (p1.y*2 + p2.y) / 3;
  t.x = (p1.x + p2.x*2) / 3;
  t.y = (p1.y + p2.y*2) / 3;
  u.x = (t.x - s.x) * cos(PI/3) - (t.y - s.y) * sin(PI/3) + s.x;
  u.y = (t.x - s.x) * sin(PI/3) + (t.y - s.y) * cos(PI/3) + s.y;

  // recursive plot
  drawKoch(n-1,p1,s);
  printf("%lf %lf\n",s.x,s.y);
  drawKoch(n-1,s,u);
  printf("%lf %lf\n",u.x,u.y);
  drawKoch(n-1,u,t);
  printf("%lf %lf\n",t.x,t.y);
  drawKoch(n-1,t,p2);

  return 1;
}

int main(){
  int n,tmp;
  Coord p1 = {0,0}, p2 = {100,0};

  // input
  scanf("%d",&n);

  // plot
  printf("%lf %lf\n",p1.x,p1.y);
  tmp = drawKoch(n,p1,p2);
  printf("%lf %lf\n",p2.x,p2.y);

  return 0;
}