#include #define debug(x) cerr << #x << ": " << x << '\n'; using namespace std; using ll = long long; using P = pair; const int INF = (int)1e9; const int MOD = (int)1e9 + 7; int N; int A[4], B[4]; int main(void){ cin >> N; for(int i = 0; i < N; i++) cin >> A[i]; for(int i = 0; i < N; i++) cin >> B[i]; int x = 0, y = 0; int ar[4]; for(int i = 0; i < N; i++) ar[i] = i; do{ y++; int win = 0, lose = 0; for(int i = 0; i < N; i++){ if(A[i] > B[ar[i]]) win++; else lose++; } if(win > lose) x++; }while(next_permutation(ar, ar+N)); // debug(x); debug(y); cout << setprecision(7) << (double) x / y << '\n'; return 0; }