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

struct p{
  double x;
  double y;
}typedef point;

void koch(int d, point p1, point p2){
  point s, u, t;
  double sin60,cos60;

  sin60 = sin(M_PI / 3);
  cos60 = cos(M_PI / 3);

  if(d == 0)
    {
      printf("%.8f %.8f\n", p2.x, p2.y);
      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) * cos60 - (t.y - s.y) * sin60 + s.x;
  u.y = (t.x - s.x) * sin60 + (t.y - s.y) * cos60 + s.y;

  koch(d - 1, p1, s);
  koch(d - 1, s, u);
  koch(d - 1, u, t);
  koch(d - 1, t, p2);
}

int main(){
  int d;
  point p1, p2;

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;
  scanf("%d", &d);

  printf("%.8f %.8f\n", p1.x, p1.y);
  koch(d, p1, p2);

  return 0;
}