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

void kock(int,double,double,double,double);

int main()
{
  int n;
  double p1_x,p1_y,p2_x,p2_y;

  scanf("%d",&n);

  p1_x = 0.0;
  p1_y = 0.0;
  p2_x = 100.0;
  p2_y = 0.0;
  
  printf("%f %f\n",p1_x,p1_y);
  kock(n,p1_x,p1_y,p2_x,p2_y);
  printf("%f %f\n",p2_x,p2_y);

  return 0;
}

void kock(int n,double p1_x,double p1_y,double p2_x,double p2_y)
{
  double s_x,s_y,u_x,u_y,t_x,t_y;

  if(n == 0) return;

  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;

 
  kock(n-1,p1_x,p1_y,s_x,s_y);
  printf("%f %f\n",s_x,s_y);
  
  kock(n-1,s_x,s_y,u_x,u_y);
  printf("%f %f\n",u_x,u_y);
  
  kock(n-1,u_x,u_y,t_x,t_y);
  printf("%f %f\n",t_x,t_y);
 
  kock(n-1,t_x,t_y,p2_x,p2_y);
  
 
}