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

struct Point{
  double s,t;};
void koch(int,struct Point,struct Point);

int main(){
  struct Point x,y;
  int n;
  scanf("%d",&n);
  x.s=0;
  x.t=0;
  y.s=100;
  y.t=0;

  printf("%.8f %.8f\n",x.s,x.t);
  koch(n,x,y);
  printf("%.8f %.8f\n",y.s,y.t);
  return 0;
}
void koch(int n,struct Point x,struct Point y){
  struct Point a,b,c;
  double ch;
  if(n==0)                                                                                                                  return;
  ch=M_PI*60.0/180.0;                                                                                                     a.s=(2.0*x.s+1.0*y.s)/3.0;
  a.t=(2.0*x.t+1.0*y.t)/3.0;
  b.s=(1.0*x.s+2.0*y.s)/3.0;
  b.t=(1.0*x.t+2.0*y.t)/3.0;                                                                                              c.s=(b.s-a.s)*cos(ch)-(b.t-a.t)*sin(ch)+a.s;
  c.t=(b.s-a.s)*sin(ch)+(b.t-a.t)*cos(ch)+a.t;


  koch(n-1,x,a);
  printf("%.8f %.8f\n",a.s,a.t);
  koch(n-1,a,c);
  printf("%.8f %.8f\n",c.s,c.t);
  koch(n-1,c,b);
  printf("%.8f %.8f\n",b.s,b.t);
  koch(n-1,b,y);
}
