//Normal #define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; void print(auto a){ cout << a; } void prints(auto a){ cout << a << " "; } void prints(){ cout << " "; } void printl(auto a){ cout << a << endl; } void printl(){ cout << endl; } void fix(int n){ cout << fixed << setprecision(n); } int main(){ int N; cin >> N; 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]; string S = "", T = ""; for(int i = 0; i < N; i++){ S += to_string(i); T += to_string(i); } int mat = 0; int win = 0; do{ do{ mat++; int po = 0; for(int i = 0; i < N; i++){ int s = S[i]-'0'; int t = T[i]-'0'; if(A[s]-B[t] > 0) po++; else if(A[s]-B[t] < 0) po--; } if(po > 0) win++; }while(next_permutation(T.begin(), T.end())); }while(next_permutation(S.begin(), S.end())); double ans = (double)win/(double)mat; fix(10); printl(ans); return 0; }