#include<stdio.h>
#include<math.h>
typedef struct{
	double x;
	double y;
}pt;
void koch(int,pt,pt);
int main(){
  pt pt1 = {0.0, 0.0}, pt2 = {100.0, 0.0};
  int n;
  scanf("%d", &n);
  printf("%f\t%f\n", pt1.x, pt1.y);
  koch(n, pt1, pt2);
  printf("%f\t%f\n", pt2.x, pt2.y);
  return 0;
}
void koch(int n,pt pt1,pt pt2){
  pt a,b,c;
  if(n == 0) return;
  a.x = (2.0*pt1.x+1.0*pt2.x)/3.0;
  a.y = (2.0*pt1.y+1.0*pt2.y)/3.0;
  b.x = (1.0*pt1.x+2.0*pt2.x)/3.0;
  b.y = (1.0*pt1.y+2.0*pt2.y)/3.0;
  c.x = (b.x-a.x)*cos(M_PI/3)-(b.y-a.y)*sin(M_PI/3)+a.x;
  c.y = (b.x-a.x)*sin(M_PI/3)+(b.y-a.y)*cos(M_PI/3)+a.y;

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