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

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

void koch(int,  point , point);

int main(){
  point a, b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);

  koch(n, a, b);

  printf("%.8f %.8f\n", b.x, b.y);

  return 0;
}

void koch(int n, point a, point b){
  point p, q, r;
  double theta;

  theta = M_PI * 60 / 180;

  if(n == 0)
    return;

  p.x = (2 * a.x + 1 * b.x) / 3;
  p.y = (2 * a.y + 1 * b.y) / 3;
  q.x = (1 * a.x + 2 * b.x) / 3;
  q.y = (1 * a.y + 2 * b.y) / 3;
  r.x = (q.x - p.x) * cos(theta) - (q.y - p.y) * sin(theta) + p.x;
  r.y = (q.x - p.x) * sin(theta) + (q.y - p.y) * cos(theta) + p.y;

  koch(n - 1, a, p);
  printf("%.8f %.8f\n", p.x, p.y);

 koch(n - 1, p, r);
  printf("%.8f %.8f\n", r.x, r.y);

  koch(n - 1, r, q);
  printf("%.8f %.8f\n", q.x, q.y);

  koch(n - 1, q, b);
}

