#include<stdio.h>
#include<math.h>
#define O 0
#define I 1
#define W 2
#define T 3
#define H 100

struct Point{
  double x;
  double y;
};

void koch(int,struct Point,struct Point);

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

  scanf("%d",&n);
  p1.x=O;
  p1.y=O;
  p2.x=H;
  p2.y=O;
 printf("%.8f %.8f\n",p1.x,p1.y);
 koch(n,p1,p2);
 printf("%.8f %.8f\n",p2.x,p2.y);
 return 0;
}
void koch(int d,struct Point p1,struct Point p2){
  struct Point s,t,u;
  double k;

  if(d==O){
      return;
    }

  k=M_PI*60/180;

  s.x=(W*p1.x+1.0*p2.x)/T;
  s.y=(W* p1.y+I*p2.y)/T;
  t.x=(I*p1.x+W*p2.x)/T;
  t.y=(I*p1.y+W*p2.y)/T;
  u.x=(t.x-s.x)*cos(k)-(t.y-s.y)*sin(k)+s.x;
  u.y=(t.x-s.x)*sin(k)+(t.y-s.y)*cos(k)+s.y;

  koch(d-I,p1,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(d-I,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(d-I,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(d-I,t,p2);
}

