#include <stdio.h>
#include <math.h>
 
#define N 4100
 
typedef struct{
  double x, y;
}P;
 
P dat[N], tmp[N];
int siz;
 
void koch(P,P,int,int);

main(){
  int i, n;
  scanf("%d",&n);
  dat[siz++] = {0.0, 0.0};
  koch(dat[0], {100.0, 0.0}, n, 0);
  dat[siz++] = {100.0, 0.0};
  for(i=0;i<siz;i++) printf("%.8f %.8f\n", dat[i].x, dat[i].y);
  return 0;
}
void koch(P a, P b, int n, int p){
  P o = {(b.x - a.x)/3.0, (b.y - a.y)/3.0};
  P s = {o.x + a.x, o.y + a.y};
  P u = {s.x + o.x /2.0 - sqrt(3.0) * o.y / 2.0, s.y + sqrt(3.0) * o.x /2.0 + o.y /2.0};
  P t = {(b.x-a.x)*2.0/3.0+a.x, (b.y-a.y)*2.0/3.0+a.y};
  if(p == n) return;
  koch(a,s,n,p+1);
  dat[siz++] = s;
  koch(s,u,n,p+1);
  dat[siz++] = u;
  koch(u,t,n,p+1);
  dat[siz++] = t;
  koch(t,b,n,p+1);
}
 