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

#define N 4097


typedef struct{
  double i,j ;
}Point;

Point data[N], tmp[N];
int size;

void kochCurve(Point a, Point b, int n, int p){
  Point o = (Point){(b.i-a.i)/3.0, (b.j-a.j)/3.0};
  Point s = (Point){o.i+a.i, o.j+a.j};
  Point u = (Point){s.i + o.i / 2.0 - sqrt(3.0) * o.j / 2.0, s.j + sqrt(3.0) * o.i / 2.0 + o.j / 2.0};
  Point t = (Point){(b.i-a.i)*2.0/3.0+a.i, (b.j-a.j)*2.0/3.0+a.j};
  if(p == n) return;
  kochCurve(a, s, n, p+1);
  data[size++] = s;
  kochCurve(s, u, n, p+1);
  data[size++] = u;
  kochCurve(u, t, n, p+1);
  data[size++] = t;
  kochCurve(t, b, n, p+1);
}

main(){
  int z, n;
  scanf("%d", &n);
  data[size++] = (Point){0.0, 0.0};
  kochCurve(data[0], (Point){100.0, 0.0}, n, 0);
  data[size++] = (Point){100.0, 0.0};
  for(z=0;z<size;z++) printf("%.8f %.8f\n", data[z].i, data[z].j);
  return 0;
}

