// Koch Curve
#include <stdio.h>
#include <math.h>

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

void koch(int n, point p1, point p2){
  point s, t, u;
  double sin, cos;
  if(n == 0)return;

  sin = sqrt(3) / (double)2; // 60度のときのsinを計算
  cos = 1 / (double)2;       // 60度のときのcosを計算
  
  s.x = (2*(double)p1.x + 1*(double)p2.x) / (double)3;
  s.y = (2*(double)p1.y + 1*(double)p2.y) / (double)3;
  t.x = (1*(double)p1.x + 2*(double)p2.x) / (double)3;
  t.y = (1*(double)p1.y + 2*(double)p2.y) / (double)3;
  
  u.x = (t.x - s.x) * cos - (t.y - s.y) * sin + s.x;
  u.y = (t.x - s.x) * sin + (t.y - s.y) * cos + s.y;
  
  // p1, p2 から s, t, u を計算
  koch(n-1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n-1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n-1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n-1, t, p2);
}

int main(){
  int n;
  point p1, p2;
  scanf("%d", &n);
  p1.x = 0.0;
  p1.y = 0.0;
  p2.x = 100.0;
  p2.y = 0.0;
  
  printf("%.8f %.8f\n", p1.x, p1.y);
  koch(n, p1, p2);
  printf("%.8f %.8f\n", p2.x, p2.y);
  
  return 0;
}

