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

#define rad M_PI/3

typedef struct{
  double x,y;
} Point;

//void print(Point);
void rec(Point,Point,int);
Point rotate(Point,Point);

int main(){
  int n;
  Point p1 = {0,0},p2 = {100,0};
  scanf("%d",&n);
  printf("%.10f %.10f\n",p1.x,p1.y);
  if(n > 0){  rec(p1,p2,n); }
  printf("%.10f %.10f\n",p2.x,p2.y);
  return 0;
}

void rec(Point p1,Point p2,int depth){
  if(depth == 0){ return; }
  Point s = {p1.x+(p2.x-p1.x)/3.0,p1.y+(p2.y-p1.y)/3.0};
  Point t = {p1.x+(p2.x-p1.x)*2.0/3.0,p1.y+(p2.y-p1.y)*2.0/3.0};
  Point u = rotate(s,t);
  rec(p1,s,depth-1);
  printf("%.10f %.10f\n",s.x,s.y);
  rec(s,u,depth-1);
  printf("%.10f %.10f\n",u.x,u.y);
  rec(u,t,depth-1);
  printf("%.10f %.10f\n",t.x,t.y);
  rec(t,p2,depth-1);
}

Point rotate(Point p1,Point p2){
  double x = p2.x-p1.x,y = p2.y-p1.y;
  Point p = {x*cos(rad)-y*sin(rad)+p1.x,x*sin(rad)+y*cos(rad)+p1.y};
  return p;
}

