#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int u, v; ll w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int INF = INT_MAX / 2; int main() { int N; double PA, PB; cin >> N >> PA >> PB; int pa = PA * 1000, pb = PB * 1000; vector A(N), B(N); for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < N; i++) cin >> B[i]; sort(A.begin(), A.end()); sort(B.begin(), B.end()); random_device rd; mt19937 mt(rd()); ll cnt = 0; for (int t = 0; t < 1000000; t++) { vector a = A, b = B; int X = 0, Y = 0; for (int i = 0; i < N; i++) { int x, y; if (a.size() == 1 || mt() % 1000 < pa) { x = a[0]; a.erase(a.begin()); } else { int j = 1 + mt() % (a.size() - 1); x = a[j]; a.erase(a.begin() + j); } if (b.size() == 1 || mt() % 1000 < pb) { y = b[0]; b.erase(b.begin()); } else { int j = 1 + mt() % (b.size() - 1); y = b[j]; b.erase(b.begin() + j); } if (x > y) X += x + y; if (x < y) Y += x + y; } cnt += X; } printf("%.10f\n", cnt / 1000000.0); }