#include <stdio.h>
#include <math.h>
struct data{
  double x;
  double y;
};
typedef struct data point;

void func(point,point,double);

int cnt;
int main (){
  point p1,p2;
  scanf("%d",&cnt);
  p1.x=0;
  p1.y=0;
  p2.x=100;
  p2.y=0;
  printf("%f %f\n",p1.x,p1.y);
  if(cnt>0) func(p1,p2,0);
  else{
    printf("%f %f\n",p2.x,p2.y);
  }
  return 0;
}

void func(point p1,point p2,double tilt){
  int bcnt=0;
  double len_x,len_y,splen;
  point p3,p4,newp;

  //make vertex
  len_x=p2.x-p1.x;
  len_y=p2.y-p1.y;
  splen=sqrt((len_y*len_y)+(len_x*len_x))/3;
  len_x/=3;
  len_y/=3;
  p3.x=p1.x+len_x;
  p3.y=p1.y+len_y;
  p4.x=p3.x+len_x;
  p4.y=p3.y+len_y;
  newp.x=p3.x+splen*(cos(M_PI/3+tilt));
  newp.y=p3.y+splen*(sin(M_PI/3+tilt));

  //recursion
  if(cnt>1){
    cnt--;
    func(p1,p3,tilt);
    func(p3,newp,M_PI/3+tilt);
    func(newp,p4,-M_PI/3+tilt);
    func(p4,p2,tilt);
    cnt++;
  }
  else{
    printf("%f %f\n",p3.x,p3.y);
    printf("%f %f\n%f %f\n",newp.x,newp.y,p4.x,p4.y);
    printf("%f %f\n",p2.x,p2.y);
  }
}
