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

void Koch(double,int);

double x;
double y;

int main(void){
  int num;
  scanf("%d",&num);
  x = 0.0;
  y = 0.0;

  printf("%.8lf %.8lf\n",0.0,0.0);
  Koch(100.0,num);
  return 0;
}

void draw_polar_line(double r,double theta){
  double radians;

  radians = theta / 180 * M_PI;
  x = x + r * cos(radians);
  y = y + r * sin(radians);

  printf("%.8lf %.8lf\n",fabs(x),fabs(y));
  if(fabs(x - 100) < 0.00001){
    exit(0);
  }
}

void draw_fractal_line(double length,double theta,int order){
  if(order == 0){
    draw_polar_line(length,theta);
  }
  else{
    draw_fractal_line(length / 3,theta,order - 1);
    draw_fractal_line(length / 3,theta + 60,order - 1);
    draw_fractal_line(length / 3,theta - 60,order - 1);
    draw_fractal_line(length / 3,theta,order - 1);
  }
}

void Koch(double size,int order){
  draw_fractal_line(size,0,order);
  draw_fractal_line(size,120,order);
  draw_fractal_line(size,240,order);
}

