#include <stdio.h>
#include <math.h>
 
#define PI 3.1415926535897932384626433832795
 
double d; int a;
double vcos[6], vsin[6];
double x, y;
 
void koch_curve(int k)
{
    if (k == 0) {
        x += d*vcos[a % 6], y += d*vsin[a%6];
        printf("%.8lf %.8lf\n", x, y);
    } else {
        d /= 3;
        koch_curve(k-1), a++, koch_curve(k-1);
        a += 4;
        koch_curve(k-1), a++, koch_curve(k-1);
        d *= 3;
    }
}
 
int main()
{
    int n, i;
     
    for (i = 0; i < 6; i++) vcos[i] = cos(i*PI/3), vsin[i] = sin(i*PI/3);
 
    scanf("%d", &n);
 
    d = 100;        // (0,0) - (100,0);
 
    a = 0, x = 0, y = 0; puts("0.00000000 0.00000000");
    koch_curve(n);
    return 0;
}
