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

typedef struct{
  double x;
  double y;
} coor;

void kock(int n,coor p1,coor p2){
  if (n == 0) return;

  coor s,t,u;

  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)*0.5 - (t.y - s.y)*(sqrt(3)/2) + s.x;
  u.y = (t.x - s.x)*(sqrt(3)/2) + (t.y - s.y)*0.5 + s.y;

  kock(n-1,p1,s);
  printf("%.8lf %.8lf\n",s.x,s.y);
  kock(n-1,s,u);
  printf("%.8lf %.8lf\n",u.x,u.y);
  kock(n-1,u,t);
  printf("%.8lf %.8lf\n",t.x,t.y);
  kock(n-1,t,p2);
}

int main(){
  int n;
  coor st,la;

  st.x = st.y = la.y = 0;
  la.x = 100;

  scanf("%d",&n);

  printf("%.8lf %.8lf\n",st.x,st.y);
  kock(n,st,la);
  printf("%.8lf %.8lf\n",la.x,la.y);

  return 0;
}
