#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 a,P b,int n,int p);

main(){
  int i, n;
  scanf("%d",&n);
  data[siz++] = (Point){0.0, 0.0};
  koch(data[0], (Point){100.0, 0.0}, n, 0);
  data[siz++] = (Point){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)/(double)3, (b.y - a.y)/(double)3;
  P s = o.x + a.x, o.y + a.y;
  P u = s.x + o.x /(double)2 - sqrt((double)3) * o.y / 2.0, s.y + sqrt((double)3) * o.x /(double)2 + o.y /(double);
  P t = (b.x-a.x)*(double)2/(double)3+a.x, (b.y-a.y)*(double)2/(double)3+a.y;
  if(p == n) return;
  koch(a,s,n,p+1);
  data[siz++] = s;
  koch(s,u,n,p+1);
  data[siz++] = u;
  koch(u,t,n,p+1);
  data[siz++] = t;
  koch(t,b,n,p+1);
}
 