#include using namespace std; typedef long long ll; typedef vector< int > vi; typedef vector< vi > vvi; typedef vector< ll > vl; typedef vector< vl > vvl; typedef pair< int, int > pii; typedef vector< pii > vp; typedef vector< double > vd; typedef vector< vd > vvd; typedef vector< string > vs; template< class T1, class T2 > int upmin( T1 &x, T2 v ){ if( x > v ){ x = v; return 1; } return 0; } template< class T1, class T2 > int upmax( T1 &x, T2 v ){ if( x < v ){ x = v; return 1; } return 0; } const int INF = 0x3f3f3f3f; const int MAXN = 20; int N; double Pa, Pb; double A[ MAXN ]; double B[ MAXN ]; void init(){ cin >> N; cin >> Pa >> Pb; for( int i = 0; i < N; ++i ){ cin >> A[ i ]; } for( int i = 0; i < N; ++i ){ cin >> B[ i ]; } } double dp_a[ 1 << MAXN ][ MAXN ]; double dp_b[ 1 << MAXN ][ MAXN ]; double turn_id_a[ MAXN ][ MAXN ]; double turn_id_b[ MAXN ][ MAXN ]; void build_dp( double p, double a[], double dp[][ MAXN ], double turn_id[][ MAXN ] ){ for( int i = 0; i < N; ++i ){ int minv = INF; for( int j = 0; j < N; ++j ){ upmin( minv, a[ j ] ); } if( a[ i ] == minv ){ dp[ 1 << i ][ i ] = p; } else{ dp[ 1 << i ][ i ] = ( 1.0 - p ) / ( N - 1 ); } } for( int s = 1; s < 1 << N; ++s ){ int minv = INF; int n = N - __builtin_popcount( s ); if( n == 1 ){ for( int i = 0; i < N; ++i ){ if( ~s & 1 << i ){ for( int j = 0; j < N; ++j ){ if( s & 1 << j ){ dp[ s | 1 << i ][ i ] += dp[ s ][ j ]; } } break; } } continue; } for( int i = 0; i < N; ++i ){ if( ~s & 1 << i ){ upmin( minv, a[ i ] ); } } for( int i = 0; i < N; ++i ){ if( s & 1 << i ){ for( int j = 0; j < N; ++j ){ if( ~s & 1 << j ){ if( a[ j ] == minv ){ dp[ s | 1 << j ][ j ] += dp[ s ][ i ] * p; } else{ dp[ s | 1 << j ][ j ] += dp[ s ][ i ] * ( 1.0 - p ) / ( n - 1 ); } } } } } } for( int s = 1; s < 1 << N; ++s ){ int turn = __builtin_popcount( s ) - 1; for( int i = 0; i < N; ++i ){ turn_id[ turn ][ i ] += dp[ s ][ i ]; } } } void preprocess(){ build_dp( Pa, A, dp_a, turn_id_a ); build_dp( Pb, B, dp_b, turn_id_b ); } void solve(){ double ans = 0.0; for( int turn = 0; turn < N; ++turn ){ for( int i = 0; i < N; ++i ){ for( int j = 0; j < N; ++j ){ if( A[ i ] <= B[ j ] ) continue; ans += turn_id_a[ turn ][ i ] * turn_id_b[ turn ][ j ] * ( A[ i ] + B[ j ] ); } } } cout << fixed << setprecision( 10 ) << ans << endl; } signed main(){ ios::sync_with_stdio( 0 ); init(); preprocess(); solve(); return 0; }