#include using namespace std; #define rep(i,n) for(ll i=0;i=0;i--) #define perl(i,r,l) for(ll i=r-1;i>=l;i--) #define fi first #define se second #define pb push_back #define ins insert #define pqueue(x) priority_queue,greater> #define all(x) (x).begin(),(x).end() #define CST(x) cout<; using vvl=vector>; using pl=pair; using vpl=vector; using vvpl=vector; const ll MOD=1000000007; const ll MOD9=998244353; const int inf=1e9+10; const ll INF=4e18; const ll dy[8]={-1,0,1,0,1,1,-1,-1}; const ll dx[8]={0,-1,0,1,1,-1,1,-1}; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } ll p,q; random_device rnd; // 非決定的な乱数生成器を生成 mt19937 mt(rnd()); // メルセンヌ・ツイスタの32ビット版、引数は初期シード値 uniform_int_distribution<> rand1(1,1000); ll point(set &a,set &b){ if(a.size()==1)return (*a.begin()>*b.begin()? *a.begin()+*b.begin():0); ll ret=0; ll x,y; if(rand1(mt)<=p)x=*a.begin(); else { uniform_int_distribution<> rand2(1,a.size()-1); ll k=rand2(mt); auto itr=a.begin();rep(i,k)itr++; x=*itr; } if(rand1(mt)<=q)y=*b.begin(); else { uniform_int_distribution<> rand2(1,b.size()-1); ll k=rand2(mt);//cout << k <y? x+y+point(a,b):point(a,b)); } int main(){ ll n;cin >> n; string pp,qq;cin >> pp >> qq; p=stoll(pp.substr(2)),q=stoll(qq.substr(2)); set a,b; ll al=0; rep(i,n){ ll x;cin >> x;a.ins(x);al+=x; } rep(i,n){ ll x;cin >> x;b.ins(x);al+=x; } double win=0,match=0; while(true){ set aa=a,bb=b; ll k=point(aa,bb); //cout << k <al-k)win++; match++; if(match>=200000)break; } CST(10); cout << win/match <