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

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

double ssyy(PP,PP,PP);
double ttyy(PP,PP,PP);
double ssxx(PP,PP,PP);
double ttxx(PP,PP,PP);
void kock(int,PP,PP);

int main(){
  int n;
  PP p1 = {0.00000000,0.00000000},p2 = {100.00000000,0.00000000};
  scanf("%d",&n);
  printf("%f %f\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%f %f\n",p2.x,p1.y);
  return 0;
}

void kock(int n,PP p1,PP p2){
  PP s,t,u;
  double th = M_PI * 60.0 / 180.0;
  if(n == 0) return;
  
  s.x = ssxx(s,p1,p2);
  t.x = ttxx(t,p1,p2);
  s.y = ssyy(s,p1,p2);
  t.y = ttyy(t,p1,p2);
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
  
  kock(n - 1,p1,s);
  printf("%f %f\n",s.x,s.y);
  kock(n - 1,s,u);
  printf("%f %f\n",u.x,u.y);
  kock(n - 1,u,t);
  printf("%f %f\n",t.x,t.y);
  kock(n - 1,t,p2);
}

double ssxx(PP ss,PP p1,PP p2){
  return ss.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
}

double ttxx(PP tt,PP p1,PP p2){
  return tt.x = (1.0 * p1.x + 2.0 * p2.x) / 3.0;
}

double ssyy(PP ss,PP p1,PP p2){
  return ss.y = (2.0 * p1.y + 1.0 * p2.y) / 3.0;
}

double ttyy(PP tt,PP p1,PP p2){
  return tt.y = (1.0 * p1.y + 2.0 * p2.y) / 3.0;
}

