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


struct P{
  double s,t;
};

void kc(int n,struct P a,struct P b){
  if(n == 0)return;
  struct P x,y,z;
  double th = M_PI *60.0/180.0;

  x.s = (2.0*a.s+1.0*b.s) / 3.0;
  x.t = (2.0*a.t+1.0*b.t) / 3.0;
  y.s = (1.0*a.s+2.0*b.s) / 3.0;
  y.t = (1.0*a.t+2.0*b.t) / 3.0;
  z.s = (y.s -x.s) * cos(th) - (y.t -x.t) * sin(th) + x.s;
  z.t = (y.s -x.s) * sin(th) + (y.t -x.t) * cos(th) + x.t;

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

int main(){
  struct P a,b;
  int l;
  scanf("%d",&l);

  a.s = 0;
  a.t = 0;
  b.s = 100;
  b.t = 0;

  printf("%.8f %.8f\n",a.s,a.t);
  kc(l,a,b);
  printf("%.8f %.8f\n",b.s,b.t);

  return 0;
}
