#include <stdio.h>
#include <math.h>
#define PI 3.14159265359
typedef struct{
  double x,y;
}P;//Point
void Koch(int ,P ,P );
double radian=PI/3;//60degrees

int main(void){
  int n;
  P p1={0,0},p2={100,0};
  scanf("%d",&n);
  printf("%.8f %.8f\n",0.0,0.0);
  Koch(n,p1,p2);
  printf("%.8f %.8f\n",100.0,0.0);
  return 0;
}

void Koch(int n,P left,P right){
  P s,t,u;
  if(n==0)return ;
  s.x=(2*left.x+right.x)/3;
  s.y=(2*left.y+right.y)/3;
  t.x=(left.x+2*right.x)/3;
  t.y=(left.y+2*right.y)/3;
  u.x=(t.x-s.x)*cos(radian)-(t.y-s.y)*sin(radian)+s.x;
  u.y=(t.x-s.x)*sin(radian)+(t.y-s.y)*cos(radian)+s.y;
  Koch(n-1,left,s);
  printf("%.8f %.8f\n",s.x,s.y);
  Koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  Koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  Koch(n-1,t,right);
}
