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

void koch(int n, double p1_x, double p1_y, double p2_x, double p2_y);

int main(int argc, char *argv[])
{
  int n;
  double p1[2], p2[2];

  p1[0] = 0;
  p1[1] = 0;
  p2[0] = 100;
  p2[1] = 0;

  scanf("%d", &n);

  printf("%f %f\n", p1[0], p1[1]);
  koch(n, p1[0], p1[1], p2[0], p2[1]);

  return 0;
}

void koch(int n, double p1_x, double p1_y, double p2_x, double p2_y)
{
  double s[2], t[2], u[2];
  double r3 = sqrt(3.0);

  if (n == 0) {
    printf("%f %f\n", p2_x, p2_y);
    return;
  } else {
    s[0] = p1_x + (p2_x - p1_x)/3.0;
    s[1] = p1_y + (p2_y - p1_y)/3.0;
    t[0] = p1_x + 2*(p2_x - p1_x)/3.0;
    t[1] = p1_y + 2*(p2_y - p1_y)/3.0;
    u[0] = s[0] + (-s[0] + r3*s[1] + t[0] - r3*t[1])/2.0;
    u[1] = s[1] + (-r3*s[0] - s[1] + r3*t[0] + t[1])/2.0;
    
    koch(n - 1, p1_x, p1_y, s[0], s[1]);
    koch(n - 1, s[0], s[1], u[0], u[1]);
    koch(n - 1, u[0], u[1], t[0], t[1]);
    koch(n - 1, t[0], t[1], p2_x, p2_y);
  }
}