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

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

void kock(int, P, P);

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

  scanf("%d",&n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;
  
  kock(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}

void kock(int n, P c, P d){
  P s,t,u;
  double r = M_PI / 3.0;

  if(n == 0){
    printf("%.8f %.8f\n",c.x,c.y);
    return;
  }

  s.x = (2.0 * c.x + 1.0 * d.x) / 3.0;
  s.y = (2.0 * c.y + 1.0 * d.y) / 3.0;
  u.x = (1.0 * c.x + 2.0 * d.x) / 3.0;
  u.y = (1.0 * c.y + 2.0 * d.y) / 3.0;
  t.x = (u.x - s.x) * cos(r) - (u.y - s.y) * sin(r) + s.x;
  t.y = (u.x - s.x) * sin(r) + (u.y - s.y) * cos(r) + s.y;

  kock(n - 1, c, s);
  kock(n - 1, s, t);
  kock(n - 1, t, u);
  kock(n - 1, u, d);
}

