#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class TheTicketsDivOne { public:
	double find(int n, int m) 
	{
		vector<double> p(1, 1.0);
		for(int N=2; N<=n; ++N) {
			vector<double> q(N, 0.0);

			// q[0] = 1/6 + 1/2 q[N-1]
			// q[i] = 1/2 q[i-1] + 1/3 p[i-1]

			double s = 1.0/6;
			double f = 1.0/3;
			for(int i=N-2; i>=0; --i) {
				f = f/2;
				s += f*p[i];
			}
			q[0] = s / (1.0 - pow(0.5, N));
			for(int i=1; i<N; ++i)
				q[i] = q[i-1]/2.0 + p[i-1]/3.0;

			p.swap(q);
		}
		return p[m-1];
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const double& Expected, const double& Received) {
 bool ok = (abs(Expected - Received) < 1e-9);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, TheTicketsDivOne().find(n, m));}
int main(){

CASE(0)
	int n = 2; 
	int m = 1; 
	double _ = 0.4444444444444444; 
END
CASE(1)
	int n = 2; 
	int m = 2; 
	double _ = 0.5555555555555556; 
END
CASE(2)
	int n = 1; 
	int m = 1; 
	double _ = 1.0; 
END
CASE(3)
	int n = 3; 
	int m = 2; 
	double _ = 0.31746031746031744; 
END
CASE(4)
	int n = 1000; 
	int m = 500; 
	double _ = -1; 
END
CASE(5)
	int n = 1; 
	int m = 1; 
	double _ = 1.0; 
END
CASE(6)
	int n = 1000; 
	int m = 1000; 
	double _ = -1; 
END
CASE(7)
	int n = 1000; 
	int m = 1; 
	double _ = -1; 
END

}
// END CUT HERE
