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

  struct Point{
    double x;
    double y;
  };

  void koch(int d, struct Point p, struct Point q){
    struct Point s, t, u;
    double k;

    if(d == 0) return;
    k = M_PI * 60.0 / 180.0;
    s.x = (2.0 * p.x + 1.0 * q.x) / 3.0;
    s.y = (2.0 * p.y + 1.0 * q.y) / 3.0;
    t.x = (1.0 * p.x + 2.0 * q.x) / 3.0;
    t.y = (1.0 * p.y + 2.0 * q.y) / 3.0;
    u.x = (t.x - s.x) * cos(k) - (t.y - s.y) * sin(k) + s.x;
    u.y = (t.x - s.x) * sin(k) + (t.y - s.y) * cos(k) + s.y;
    koch(d-1, p, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(d-1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(d-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(d-1, t, q);
  }

  int main(){
    struct Point p, q;
    int n;

    scanf("%d", &n);
    p.x = 0;
    p.y = 0;
    q.x = 100;
    q.y = 0;
   printf("%.8f %.8f\n", p.x, p.y);
   koch(n, p, q);
   printf("%.8f %.8f\n", q.x, q.y);

   return 0;
  }
