/* C Koch Curve */

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

#define PI 3.1415926585

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

Point KochCurve(Point,Point,int);

int main(){
  Point lp={0,0},rp={100,0};
  int n;

  scanf("%d",&n);
  KochCurve(lp,rp,n);
  printf("%f %f\n",rp.x,rp.y);

  return 0;
}
/*(0,0),(100,0)*/
Point KochCurve(Point lp, Point rp, int n){
  Point left, mid, right, d;
  if(n==0){
    printf("%f %f\n",lp.x,lp.y);

  }else{
  d.x=rp.x-lp.x;
  d.y=rp.y-lp.y;

  left.x=lp.x+d.x/3;
  left.y=lp.y+d.y/3;

  right.x=lp.x+d.x*2/3;
  right.y=lp.y+d.y*2/3;

  mid.x=left.x+(d.x/3)*cos(PI/3)-(d.y/3)*sin(PI/3);
  mid.y=left.y+(d.x/3)*sin(PI/3)+(d.y/3)*cos(PI/3);


  KochCurve(lp,left,n-1);
  KochCurve(left,mid,n-1);
  KochCurve(mid,right,n-1);
  KochCurve(right,rp,n-1);
  }
}