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

struct Point{double x,y;};

void koch(int,struct Point,struct Point);

int main(){
struct Point l,m;
  int n;
  scanf("%d",&n);
  l.x=0;
  l.y=0;
  m.x=100.0;
  m.y=0;
  printf("%.8f %.8f\n",l.x,l.y);
  koch(n,l,m);
  printf("%.8f %.8f\n",m.x,m.y);

  return 0;
}
void koch(int a,struct Point b,struct Point c){
  if(a == 0){
    return;
  }
  struct Point s,t,u;
  double th;
  th =(M_PI * 60.0) / 180.0;
  s.x = (2.0 * b.x + 1.0 * c.x)/3.0;
  s.y = (2.0 * b.y + 1.0 * c.y)/3.0;
  t.x = (1.0 * b.x + 2.0 * c.x)/3.0;
  t.y = (1.0 * b.y + 2.0 * c.y)/3.0;
  u.x = (t.x - s.x)*cos(th) - (t.y -s.y)*sin(th) + s.x;
  u.y = (t.x - s.x)*sin(th) + (t.y -s.y)*cos(th) + s.y;
  koch(a-1,b,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(a-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(a-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(a-1,t,c);
}

