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

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

void kock( int, xy, xy );

int main()
{
  xy s1, s2;
  int h;

  s1.x = 0;
  s1.y = 0;
  s2.x = 100;
  s2.y = 0;

  scanf("%d", &h);
  printf("%.8f %.8f\n", s1.x, s1.y);
  kock( h, s1, s2 );
  printf("%.8f %.8f\n", s2.x, s2.y);

  return 0;
}



void kock( int h, xy s1, xy s2 )
{
  xy a, b, c;
  
  if( h == 0 ) return;
  
  a.x = ((2*s1.x)+(1*s2.x)) / 3;
  a.y = ((2*s1.y)+(1*s2.y)) / 3;
  b.x = ((1*s1.x)+(2*s2.x)) / 3;
  b.y = ((1*s1.y)+(2*s2.y)) / 3;
  
  c.x = (b.x-a.x)*cos(M_PI/3.0) - (b.y-a.y)*sin(M_PI/3.0) + a.x;
  c.y = (b.x-a.x)*sin(M_PI/3.0) + (b.y-a.y)*cos(M_PI/3.0) + a.y;
  

  kock(h-1, s1, a);
  printf("%.8f %.8f\n", a.x, a.y);
  kock(h-1, a, c);
  printf("%.8f %.8f\n", c.x, c.y);
  kock(h-1, c, b);
  printf("%.8f %.8f\n", b.x, b.y);
  kock(h-1, b, s2);

}

