#include <stdio.h>
#include <math.h>
int n,count=0;
double rad = M_PI/3;

void segment(double x1, double y1, double x5, double y5, int count){
  double x2, y2, x3, y3, x4, y4;
  
  x2 = (2*x1+x5)/3.0;
  y2 = (2*y1+y5)/3.0;
  x4 = (x1+2*x5)/3.0;
  y4 = (y1+2*y5)/3.0;
  x3 = x2+(x4-x2)*cos(rad) - (y4-y2)*sin(rad);
  y3 = y2+(x4-x2)*sin(rad) + (y4-y2)*cos(rad);
  count++;
  if(count != n){
    segment(x1, y1, x2, y2, count);
    segment(x2, y2, x3, y3, count);
    segment(x3, y3, x4, y4, count);
    segment(x4, y4, x5, y5, count);
  }
  else{
    printf("%f %f\n",x2,y2);
    printf("%f %f\n",x3,y3);
    printf("%f %f\n",x4,y4);
    printf("%f %f\n",x5,y5);
  }
}

int main(){
  double x1=0, x2=100;
  scanf("%d",&n);
  printf("%f %f\n",x1 ,x1);
  segment(x1, x1, x2, x1, count);
  return 0;
}