#include<stdio.h>
#include<math.h>
#define M_PI 3.14159265358979323846

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

void co(int n,Point p1,Point p2){
  if(n==0)return;
  Point a,b,c;
  double t=M_PI*60.0/180.0;
  a.x=(2.0*p1.x+1.0*p2.x)/3.0;
  a.y=(2.0*p1.y+1.0*p2.y)/3.0;
  b.x=(1.0*p1.x+2.0*p2.x)/3.0;
  b.y=(1.0*p1.y+2.0*p2.y)/3.0;
  c.x=(b.x-a.x)* cos(t)-(b.y-a.y)* sin(t)+a.x;
  c.y=(b.x-a.x)* sin(t)+(b.y-a.y)* cos(t)+a.y;

  co(n-1,p1,a);
  printf("%.8f %.8f\n",a.x,a.y);
  co(n-1, a, c);
  printf("%.8f %.8f\n",c.x,c.y);
  co(n-1,c, b);
  printf("%.8f %.8f\n",b.x,b.y);
  co(n-1,b,p2);
}

int main(){
  Point p1,p2;
  int n;

  scanf("%d",&n);
  p1.x=0;
  p1.y=0;
  p2.x=100;
  p2.y=0;

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

  return 0;
}

