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

struct Node
{
  double p1;
  double p2;
};

int kock(int n,struct Node A,struct Node B)
{
  struct Node a, b, c;
  if(n == 0)
    {
      return 0;
    }
  a.p1 = (2*A.p1 + B.p1) / 3;
  a.p2 = (2*A.p2 + B.p2) / 3;
  b.p1 = (A.p1 + 2*B.p1) / 3;
  b.p2 = (A.p2 + 2*B.p2) / 3;
  c.p1 = (b.p1 - a.p1) * cos(M_PI/3) - (b.p2 - a.p2) * sin(M_PI / 3) + a.p1;
  c.p2 = (b.p1 - a.p1) * sin(M_PI/3) + (b.p2 - a.p2) * cos(M_PI / 3) + a.p2;
  kock(n - 1, A, a);
  printf("%f %f\n", a.p1, a.p2);
  kock(n - 1, a, c);
  printf("%f %f\n", c.p1, c.p2);
  kock(n - 1, c, b);
  printf("%f %f\n", b.p1, b.p2);
  kock(n - 1, b, B);
  return 1;
}

int main()
{
  int n;
  struct Node A = {0.0, 0.0}, B = {100.0, 0.0};
  scanf("%d", &n);
  printf("%f %f\n", A.p1, A.p2);
  kock(n, A, B);
  printf("%f %f\n", B.p1, B.p2);
  return 0;
}

