#include // c #include // io #include #include #include #include // container #include #include #include #include #include #include // other #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; #define ALL(c) (begin(c)),(end(c)) #define REP(i,n) FOR(i,0,n) #define REPr(i,n) FORr(i,0,n) #define FOR(i,l,r) for(int i=(int)(l);i<(int)(r);++i) #define FORr(i,l,r) for(int i=(int)(r)-1;i>=(int)(l);--i) #define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it) #define IN(l,v,r) ((l)<=(v) && (v)<(r)) #define UNIQUE(v) v.erase(unique(ALL(v)),v.end()) //debug #define DUMP(x) cerr << #x << " = " << (x) #define LINE() cerr<< " (L" << __LINE__ << ")" class range { private: struct Iter{ int v; int operator*(){return v;} bool operator!=(Iter& itr) {return v < itr.v;} void operator++() {++v;} }; Iter i, n; public: range(int n) : i({0}), n({n}) {} range(int i, int n) : i({i}), n({n}) {} Iter& begin() {return i;} Iter& end() {return n;} }; //input template istream& operator >> (istream& is,pair& p){is>>p.first>>p.second;return is;} template istream& operator >> (istream& is,tuple& t){is >> get<0>(t);return is;} template istream& operator >> (istream& is,tuple& t){is >> get<0>(t) >> get<1>(t);return is;} template istream& operator >> (istream& is,tuple& t){is >>get<0>(t)>>get<1>(t)>>get<2>(t);return is;} template istream& operator >> (istream& is,tuple& t){is >> get<0>(t)>>get<1>(t)>>get<2>(t)>>get<3>(t);return is;} template istream& operator >> (istream& is, const tuple& t){is >> get<0>(t) >> get<1>(t) >> get<2>(t) >> get<3>(t) >> get<4>(t);return is;} template istream& operator >> (istream& is, const tuple& t){is >> get<0>(t) >> get<1>(t) >> get<2>(t) >> get<3>(t) >> get<4>(t) >> get<5>(t);return is;} template istream& operator >> (istream& is, const tuple& t){is >> get<0>(t) >> get<1>(t) >> get<2>(t) >> get<3>(t) >> get<4>(t) >> get<5>(t) >> get<6>(t);return is;} template istream& operator >> (istream& is,vector& as){REP(i,as.size())is >>as[i];return is;} //output template ostream& operator << (ostream& os, const set& ss){for(auto a:ss){if(a!=ss.begin())os<<" "; os< ostream& operator << (ostream& os, const pair& p){os< ostream& operator << (ostream& os, const map& m){bool isF=true;for(auto& p:m){if(!isF)os< ostream& operator << (ostream& os, const tuple& t){os << get<0>(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const vector& as){REP(i,as.size()){if(i!=0)os<<" "; os< ostream& operator << (ostream& os, const vector>& as){REP(i,as.size()){if(i!=0)os< T INF(){assert(false);}; template<> int INF(){return 1<<28;}; template<> ll INF(){return 1LL<<58;}; template<> double INF(){return 1e16;}; template<> long double INF(){return 1e16;}; template T EPS(){assert(false);}; template<> int EPS(){return 1;}; template<> ll EPS(){return 1LL;}; template<> double EPS(){return 1e-8;}; template<> long double EPS(){return 1e-8;}; template T pmod(T v,U M){return (v%M+M)%M;} class Main{ public: void run(){ int N;double PA,PB;cin >> N >> PA >> PB;PA*=1000,PB*=1000; vector as(N),bs(N); cin >> as >> bs; sort(ALL(as));sort(ALL(bs)); double win =0,c=0; while(c<100000){ vector tas=as,tbs=bs; ll AP=0,BP=0; for(int i:range(N)){ ll a,b; if(tas.size() == 1 || rand()%1001<=PA){ a=tas[0]; tas.erase(tas.begin()+0); }else{ int j = rand()%(tas.size()-1)+1; a=tas[j]; tas.erase(tas.begin()+j); } if(tbs.size() == 1 || rand()%1001<=PB){ b=tbs[0]; tbs.erase(tbs.begin()+0); }else{ int j = rand()%(tbs.size()-1)+1; b=tbs[j]; tbs.erase(tbs.begin()+j); } if(a>b)AP+=a+b; else if(aBP)win++; c++; } cout << win/c<