#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i, n) for(int i = 0; i < (n); i++) using namespace std; using ll = long long; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } int main() { int N; cin >> N; vector A(N), B(N); rep(i, N) cin >> A[i]; rep(i, N) cin >> B[i]; vector ai(N), bi(N); iota(ai.begin(), ai.end(), 0); iota(bi.begin(), bi.end(), 0); int res = 0; do { do { vector x(N); rep(i, N){ x[ai[i]] += A[i]; x[bi[i]] -= B[i]; } int win = 0; rep(i, N) { if(x[i] > 0) win++; } if(win > N/2.0) res++; } while(next_permutation(bi.begin(), bi.end())); } while(next_permutation(ai.begin(), ai.end())); int fac = 1; for(int i=2; i<=N; i++) fac = fac*i; int all = fac*fac; cout << (double)res/all << endl; return 0; }