#include<stdio.h>
#include<math.h>
#define PI 3.141592

void koch(int n, double p1x,double p1y,double p2x,double p2y){
  if(!n)return;
  double sx,sy,tx,ty,ux,uy;

  sx = (2*p1x+p2x)/3;
  sy = (2*p1y+p2y)/3;
  tx = (p1x+2*p2x)/3;
  ty = (p1y+2*p2y)/3;

  ux = (tx-sx)*cos(PI/3)-(ty-sy)*sin(PI/3)+sx;
  uy = (tx-sx)*sin(PI/3)+(ty-sy)*cos(PI/3)+sx;
  koch(n-1,p1x,p1y,sx,sy);
  printf("%f %f\n",sx,sy);
  koch(n-1,sx,sy,ux,uy);
  printf("%f %f\n",ux,uy);
  koch(n-1,ux,uy,tx,ty);
  printf("%f %f\n",tx,ty);
  koch(n-1,tx,ty,p2x,p2y);
}

int main(){
  int n;

  scanf("%d",&n);
  printf("%f %f\n",0.0,0.0);
  koch(n,0.0,0.0,100.0,0.0);
  printf("%f %f\n",100.0,0.0);
  return 0;
}