#include<stdio.h>
#include<math.h>
typedef struct {
  double x, y;
} Point;
void print(Point e){ printf("%.8f %.8f\n", e.x, e.y); }
void plot(int n, Point p1, Point p2){
  Point a, t, u;
  double th = 60.0*(acos(-1)/180.0);
  if ( n == 0 ) return;
  a.x = (2.0 * p1.x + 1.0 * p2.x)/3.0;
  a.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 - a.x) * cos(th) - (t.y - a.y ) * sin(th) + a.x;
  u.y = (t.x - a.x) * sin(th) + (t.y - a.y ) * cos(th) + a.y;  
  plot(n-1, p1, a);
  print(a);
  plot(n-1, a, u);
  print(u);
  plot(n-1, u, t);
  print(t);
  plot(n-1, t, p2);
}
int main(){
  Point p1, p2;
  int n;
  scanf("%d", &n);
  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;
  print(p1);
  plot(n, p1, p2);
  print(p2);
  return 0;
}



