/************************************
 *  Event  :      Interuni 2009, Vologda
 *  Problem:      Game
 *  Author:       Pavel Kuznetsov
 *  Last update:  2009.02.21 23:28
 ************************************
*/

#include <map> 
#include <set> 
#include <stdio.h>
#include <string.h>
#include <queue> 
#include <bitset> 
#include <valarray> 
#include <complex> 
#include <iostream> 
#include <sstream> 
#include <cmath> 
#include <algorithm> 
#include <string> 
#include <cassert> 

using namespace std;

// prewritten code

#define Size(x) (int)(x).size()
#define For(i,a,b) for(int i=(int)(a);i<=(int)(b);++i)
#define Ford(i,a,b) for(int i=(int)(a);i>=(int)(b);--i) 
#define RepV(i,v) for (int i=0;i<Size(v);++i)
#define All(c) (c).begin(),(c).end()
#define Fill(a,b) memset(&a,b,sizeof(a))
#define Min(a,b) ((a)<(b)?(a):(b))
#define Max(a,b) ((a)>(b)?(a):(b))
#define Abs(a) ((a)<0?-(a):(a))
#define VVI vector<vector<int> >
#define VI vector<int>
#define VVS vector<vector<string> >
#define VS vector<string>
#define ForEach(it,a) for (typeof((a).begin()) it=(a).begin(); it!=(a).end(); ++it)
#define DBG(x) cout << #x <<" = "<< x << endl;
#define DBGA(x) {cout << #x <<": "; for (int i=0; i<(int)sizeof(x)/(int)sizeof(x[0]); ++i) cout<<x[i]<<' '; cout<<endl;}
#define DBGV(x) {cout << #x <<": "; for (int i=0; i<(int)Size(x); ++i) cout<<x[i]<<' '; cout<<endl;}

const string problem_name = "game";

const int MINS = 1;
const int MAXS = 100;
const double MINP = 0.5;
const double MAXP = 1;
const int MAX_DIGITS = 8;

const double eps = 1e-9;

int s, rr=0;
double pa, pb;
vector<pair<double,double> > candidates;

// Linear system
// ax+by=c
// dx+ey=f
void add_candidate(double a, double b, double c, double d, double e, double f){
	if (Abs(a*e-b*d) < eps) return; // No, or infinitely many solutions
	
	// The only solution
	double x = (c*e-b*f)/(a*e-b*d);
	double y = (a*f-c*d)/(a*e-b*d);
	
	// Our candidate
	candidates.push_back(make_pair(x,y));
}

double solve(){
	double res[2][2]={0,0,0,0};
	For(i,1,s) {
		int k = 1^i&1;
		candidates.clear();
		
		// Make list of candidates
		add_candidate(1,pa,pa+(1-pa)*(1-res[k][1]),pb,1,pb+(1-pb)*(1-res[k][0]));
		add_candidate(1,pa,pa+(1-pa)*(1-res[k][1]),1-pb,1,1-pb+pb*(1-res[k][0]));
		add_candidate(1,1-pa,1-pa+pa*(1-res[k][1]),pb,1,pb+(1-pb)*(1-res[k][0]));
		add_candidate(1,1-pa,1-pa+pa*(1-res[k][1]),1-pb,1,1-pb+pb*(1-res[k][0]));
		
		// Check each candidate
		RepV(j,candidates) {
			double r1=candidates[j].first, r2=candidates[j].second;
			double nr1 = Max(pa*(1-r2)+(1-pa)*(1-res[k][1]),pa*(1-res[k][1])+(1-pa)*(1-r2));
			double nr2 = Max(pb*(1-r1)+(1-pb)*(1-res[k][0]),pb*(1-res[k][0])+(1-pb)*(1-r1));
			if (Abs(r1-nr1) < eps && Abs(r2-nr2)<eps) {
				// Candidate is real solution
				res[i&1][0] = r1;
				res[i&1][1] = r2;
				
				break;
			}
		}
	}
	
	return res[s&1][0];
}

int main(){
//	freopen((problem_name+".in").c_str(),"rt",stdin);
//	freopen((problem_name+".out").c_str(),"wt",stdout);
	
	scanf("%d",&s);
	
	char tmp[100];
	scanf("%s", tmp);
	int len = strlen(tmp);
	assert(3 <= len && len <= MAX_DIGITS + 2);
	assert(tmp[0]=='0' && tmp[1]=='.');
	assert( '5' <= tmp[2] && tmp[2] <= '9' );
	For(i,3,len-1) assert( '0' <= tmp[i] && tmp[i] <= '9' );
	sscanf(tmp,"%lf",&pa);
	
	scanf("%s", tmp);
	len = strlen(tmp);
	assert(3 <= len && len <= MAX_DIGITS + 2);
	assert(tmp[0]=='0' && tmp[1]=='.');
	assert( '5' <= tmp[2] && tmp[2] <= '9' );
	For(i,3,len-1) assert( '0' <= tmp[i] && tmp[i] <= '9' );
	sscanf(tmp,"%lf",&pb);
	
	string st;
	while (cin >> st) assert(st=="");
	
	if (s > MAXS) s = MAXS;	
	assert(1 <= s);
		
	printf("%.10lf",solve());
	
	return 0;
}
