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

typedef struct{
  double x,y;
}Point;

void print(Point p){
  printf("%.8f %.8f\n",p.x,p.y);
}

void plot(int n,Point p1,Point p2){
  Point s,t,u;
  double th = 60.0*(acos(-1) / 180.0);

  if(n == 0) return;

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

  plot(n - 1,p1,s);
  print(s);
  plot(n - 1,s,u);
  print(u);
  plot(n - 1,u,t);
  print(t);
  plot(n - 1,t,p2);
}

int main(){
  Point p1,p2;
  int n;

  scanf("%d",&n);

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;
  print(p1);
  plot(n,p1,p2);
  print(p2);

  return 0;
}

