/*
AizuOnline A1056
Title Ben Toh
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int n;
//
double kitaichi(int x)
{
        int i,j;
        double sum,p;

        if(x==0)
                return(0.0);
        if(x==1)
                return(1.0);
        if(x==2)
                return(1.5);
        if(x==3)
        {
                sum = (1/2.0)*(1+kitaichi(x-2));
                sum += (1/2.0)*(3/4.0)*2;
                sum += (1/2.0)*(1/4.0)*3;
                return(sum);
        }
        if(x==4)
        {
                sum = (1/2.0)*(1+kitaichi(x-2));
                sum += (1/2.0)*(3/4.0)*(2+kitaichi(x-3));
                sum += (1/2.0)*(1/4.0)*(7/8.0)*3;
                sum += (1/2.0)*(1/4.0)*(1/8.0)*4;
                return(sum);
        }
        if(x==5)
        {
                sum = (1/2.0)*(1+kitaichi(x-2));
                sum += (1/2.0)*(3/4.0)*(2+kitaichi(x-3));
                sum += (1/2.0)*(1/4.0)*(7/8.0)*(3+kitaichi(x-4));
                sum += (1/2.0)*(1/4.0)*(1/8.0)*(15/16.0)*4;
                sum += (1/2.0)*(1/4.0)*(1/8.0)*(1/16.0)*5;
                return(sum);
        }
        if(x>5)
        {
                sum = (1/2.0)*(1+kitaichi(x-2));
                sum += (1/2.0)*(3/4.0)*(2+kitaichi(x-3));
                sum += (1/2.0)*(1/4.0)*(7/8.0)*(3+kitaichi(x-4));
                sum += (1/2.0)*(1/4.0)*(1/8.0)*(15/16.0)*(4+kitaichi(x-5));
                sum += (1/2.0)*(1/4.0)*(1/8.0)*(1/16.0)*(1/32.0)*6;
                return(sum);
        }
        
}
main()
{
        while(scanf("%d",&n) && n)
        {
                printf("%lf\n",kitaichi(n));
        }
return(0);
}