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

#define iin(x) scanf("%d", &x)
#define lin(x) scanf("%lld", &x)
#define fin(x) scanf("%lf", &x)

#define iout(x) printf("%d", x)
#define lout(x) printf("%d", x)
#define fout(x) printf("%.10f", x)
#define _ putchar(' ')
#define endl puts("")

#define REP(i, x, n) for(i = (x); i < (n); i++)
#define rep(i, n) REP(i, 0, n)

#define PI acos(-1)

typedef struct {
  double x, y;  
} Point;

Point triPoint(Point s, Point t) {
  Point p;
  p.x = (t.x-s.x)*cos(PI/3) - (t.y-s.y)*sin(PI/3) + s.x;
  p.y = (t.x-s.x)*sin(PI/3) + (t.y-s.y)*cos(PI/3) + s.y;
  return p;
}

void Koch(int n, Point p1, Point p2) {
  if(n == 0) return;
  Point s = (Point){(2*p1.x+p2.x)/3, (2*p1.y+p2.y)/3};
  Point t = (Point){(p1.x+2*p2.x)/3, (p1.y+2*p2.y)/3};
  Point u = triPoint(s, t);
  Koch(n-1, p1, s);
  fout(s.x),_,fout(s.y),endl;
  Koch(n-1, s, u);
  fout(u.x),_,fout(u.y),endl;
  Koch(n-1, u, t);
  fout(t.x),_,fout(t.y),endl;
  Koch(n-1, t, p2);
}

int main() {
  int n;
  iin(n);
  fout(0.0),_,fout(0.0),endl;
  Koch(n, (Point){0, 0}, (Point){100, 0});
  fout(100.0),_,fout(0.0),endl;
  return 0;
}