#include <stdio.h>
#include <math.h>
 
typedef struct{
  double x;
  double y;
}Point;
 
int Ans(Point,Point,int);

int main(){
int n;
  Point p1,p2;
 
  p1.x=0.0;
  p1.y=0.0;
  p2.x=100.0;
  p2.y=0.0;
   
  scanf("%d",&n);
  printf("%f %f\n",p1.x,p1.y);
  Ans(p1,p2,n);
  printf("%f %f\n",p2.x,p2.y);
  return 0;
}
 
 
int Ans(Point p1,Point p2,int n){
  Point a,u,t;
 
  if(n==0)return 0;
 
  a.x=(p2.x-p1.x)/3.0+p1.x;
  a.y=(p2.y-p1.y)/3.0+p1.y;
   
  t.x=2*((p2.x-p1.x)/3.0)+p1.x;
  t.y=2*((p2.y-p1.y)/3.0)+p1.y;
 
  u.x=(t.x-a.x)*(1.0/2.0)-(t.y-a.y)*(sqrt(3.0)/2.0)+a.x;
  u.y=(t.x-a.x)*(sqrt(3.0)/2.0)+(t.y-a.y)*(1.0/2.0)+a.y;
 
  Ans(p1,a,n-1);
  printf("%f %f\n",a.x,a.y);
  Ans(a,u,n-1); 
  printf("%f %f\n",u.x,u.y);
  Ans(u,t,n-1);
  printf("%f %f\n",t.x,t.y);
  Ans(t,p2,n-1);
  
  return 0;
}

