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

typedef struct {
  double x, y;
} Plot;

/* プロトタイプ宣言 */
void print(Plot p);
void kock(int n, Plot p1, Plot p2);

int main() {
int n;
  Plot p1, p2;
  scanf("%d", &n);

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;
  print(p1);
  kock(n, p1, p2);
  print(p2);

  return 0;
}

void print(Plot p){ printf("%.8f %.8f\n", p.x, p.y); }

void kock(int n, Plot p1, Plot p2) {
  Plot s, t, u;
  double rot = 60.0*(acos(-1)/180.0);
  if ( n == 0 ) return;
  
  s.x = (2.0 * p1.x + 1.0 * p2.x)/3.0;
  s.y = (2.0 * p1.y + 1.0 * p2.y)/3.0;
  t.x = (1.0 * p1.x + 2.0 * p2.x)/3.0;
  t.y = (1.0 * p1.y + 2.0 * p2.y)/3.0;
  u.x = (t.x - s.x) * cos(rot) - (t.y - s.y ) * sin(rot) + s.x;
  u.y = (t.x - s.x) * sin(rot) + (t.y - s.y ) * cos(rot) + s.y;
  
  kock(n-1, p1, s);
  print(s);
  kock(n-1, s, u);
  print(u);
  kock(n-1, u, t);
  print(t);
  kock(n-1, t, p2);
}




