#include<iostream>
#include<math.h>
using namespace std;

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

void print(point p){
  cout << p.x << " " << p.y << endl;
}

void koch(int n, point p1, point p2){
  if (n == 0) return;

  point s, u, t;
  double th = M_PI * 60.0 / 180.0;

  s.x = p1.x * 2 / 3  + p2.x / 3;
  s.y = p1.y * 2 / 3  + p2.y / 3;
  t.x = p1.x / 3  + p2.x * 2 / 3;
  t.y = p1.y / 3  + p2.y * 2 / 3;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  koch(n-1, p1,s);

  print(s);
  koch(n-1, s,u);

  print(u);
  koch(n-1, u,t);

  print(t);
  koch(n-1, t,p2);
}

int main(){
  int n;
  cin >> n;
  point s, e;
  s.x = 0.0;
  s.y = 0.0;
  e.x = 100.0;
  e.y = 0.0;

  print(s);
  koch(n, s, e);
  print(e);

  return 0;
}
