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

typedef struct{
  double x;
  double y;
}Point;

void func(int, Point, Point);

int main(){

  int n;
  Point p1, p2;

  p1.x=0;
  p1.y=0;
  p2.x=100;
  p2.y=0;

  scanf("%d", &n);
  printf("%.8lf %.8lf\n", p1.x, p1.y);

  func(n, p1, p2);

  printf("%.8lf %.8lf\n", p2.x, p2.y);

  return 0;

}

void func(int n, Point p1, Point p2){

  Point a, b, c;

  if(n==0){
    return;
  }
  else{

    a.x=p1.x + (p2.x - p1.x)/3.0;
    a.y=p1.y + (p2.y - p1.y)/3.0;

    b.x=p1.x + 2.0*(p2.x - p1.x)/3.0;
    b.y=p1.y + 2.0*(p2.y - p1.y)/3.0;

    c.x= a.x + (b.x - a.x)*cos(60.0*M_PI/180.0) - (b.y - a.y)*sin(60.0*M_PI/180.0);
    c.y= a.y + (b.x - a.x)*sin(60.0*M_PI/180.0) + (b.y - a.y)*cos(60.0*M_PI/180.0);

    func(n-1, p1, a);
    printf("%.8lf %.8lf\n", a.x, a.y);
    func(n-1, a, c);
    printf("%.8lf %.8lf\n", c.x, c.y);
    func(n-1, c, b);
    printf("%.8lf %.8lf\n", b.x, b.y);
    func(n-1, b, p2);
  }
}
     

