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

struct point {double x,y;};

void kock(int n,struct point p1,struct point p2){
  struct point s,u,t;
  double radian;

  radian = 60.0 * (M_PI / 180.0);
  
  if(n == 0) return;

  s.x = (2.0 * p1.x + 1.0 * p2.x)/3;
  s.y = (2.0 * p1.y + 1.0 * p2.y)/3;
  t.x = (1.0 * p1.x + 2.0 * p2.x)/3;
  t.y = (1.0 * p1.y + 2.0 * p2.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;

  kock(n-1,p1,s);
  printf("%.8f %.8f\n",s.x,s.y);
  
  kock(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);

  kock(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);

  kock(n-1,t,p2);
}

int main(){
  int n;
  struct point a,z;
  
  scanf("%d",&n);
  
  a.x = 0.0;
  a.y = 0.0;
  z.x = 100.0;
  z.y = 0.0;

  printf("%.8f %.8f\n",a.x,a.y);
  kock(n,a,z);
  printf("%.8f %.8f\n",z.x,z.y);

  return 0;
}

