#include<stdio.h>
#include<math.h>
int n;
void koch(double p1x, double p1y, double p2x, double p2y, int c){
  double s_x, s_y, t_x, t_y, u_x, u_y;
  if(c != 0){
    s_x = (2 * p1x + p2x) / 3;
    s_y = (2 * p1y + p2y) / 3;
    t_x = (p1x + 2 * p2x) / 3;
    t_y = (p1y + 2 * p2y) / 3;
    u_x = s_x + (t_x - s_x) * cos(M_PI/3) - (t_y - s_y) * sin(M_PI/3);
    u_y = s_y + (t_x - s_x) * sin(M_PI/3) + (t_y - s_y) * cos(M_PI/3);
 
    koch(p1x, p1y, s_x, s_y, c - 1);
    printf("%f %f\n", s_x, s_y);
    koch(s_x, s_y, u_x, u_y, c - 1);
    printf("%f %f\n", u_x, u_y);
    koch(u_x, u_y, t_x, t_y, c - 1);
    printf("%f %f\n", t_x, t_y);
    koch(t_x, t_y, p2x, p2y, c - 1);
  }
}
 
int main(){
  scanf("%d", &n);
  printf("%f %f\n", 0.0, 0.0);
  koch(0.0, 0.0, 100.0, 0.0, n);
  printf("%f %f\n", 100.0, 0.0);
  return 0;
}

