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

double pi=3.14159265358979;

typedef struct P{
  double x;
  double y;
}point;

void printp(point );
void koch(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);
  
  printp(p1);
  koch(n,p1,p2);
  
  printp(p2);
  return 0;
}

void printp( point p){
  printf("%.8f %.8f\n",p.x,p.y);
}

void koch(int n,point p1,point p2){
  if(n==0) return ;
  point a,b,c;
  
  a.x=(2*p1.x+p2.x)/3;
  a.y=(2*p1.y+p2.y)/3;
  
  b.x=(p1.x+2*p2.x)/3;
  b.y=(p1.y+2*p2.y)/3;
  
  c.x=(b.x-a.x)*cos(pi/3)-(b.y-a.y)*sin(pi/3)+a.x;
  c.y=(b.x-a.x)*sin(pi/3)+(b.y-a.y)*cos(pi/3)+a.y;
  
  koch(n-1,p1,a);
  printp(a);
  
  koch(n-1,a,c);
  printp(c);
  
  koch(n-1,c,b);
  printp(b);
  
  koch(n-1,b,p2);
  return ;
}

