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

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

void fractal(int,Point,Point);

int main(){

  Point p1,p2;
  int n;

  p1.x = 0;
  p2.x = 100;
  p1.y = 0;
  p2.y = 0;

  scanf("%d",&n);

  printf("%f %f\n",p1.x,p1.y);
  fractal(n,p1,p2);
  printf("%f %f\n",p2.x,p2.y);

  return 0;
}

void fractal(int n, Point p1, Point p2){

  if(n==0) return;
  Point a,b,c;

  a.x = (p2.x-p1.x)/3+p1.x;
  a.y = (p2.y-p1.y)/3+p1.y;
  b.x = 2*(p2.x-p1.x)/3+p1.x;
  b.y = 2*(p2.y-p1.y)/3+p1.y;
  c.x = (b.x-a.x)/2-sqrt(3)/2*(b.y-a.y)+a.x;
  c.y = (b.y-a.y)/2+sqrt(3)/2*(b.x-a.x)+a.y;

  fractal(n-1,p1,a);
  printf("%f %f\n",a.x,a.y);

  fractal(n-1,a,c);
  printf("%f %f\n",c.x,c.y);

  fractal(n-1,c,b);
  printf("%f %f\n",b.x,b.y);

  fractal(n-1,b,p2);
}