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

#define N 4097


typedef struct{
  double x, y;
}Point;

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

void kochCurve(Point a, Point b, int n, int p){
  Point o = (Point){(b.x-a.x)/3.0, (b.y-a.y)/3.0};
  Point s = (Point){o.x+a.x, o.y+a.y};
  Point u = (Point){s.x + o.x / 2.0 - sqrt(3.0) * o.y / 2.0, s.y + sqrt(3.0) * o.x / 2.0 + o.y / 2.0};
  Point t = (Point){(b.x-a.x)*2.0/3.0+a.x, (b.y-a.y)*2.0/3.0+a.y};
  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 i, 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(i=0;i<size;i++) printf("%.8f %.8f\n", data[i].x, data[i].y);
  return 0;
}