#include <bits/stdc++.h>   using namespace std;   int n, a[16], b[16];   int main() {     double cnt = 0;     ios::sync_with_stdio(false);     cin >> n;     for (register int i = 0; i < n; i++) cin >> a[i];     for (register int i = 0; i < n; i++) cin >> b[i];     for (register int i = 0; i < 1e6; ++i) {       register bool f = false;       for (register int j = 0; !f && j < n; ++j) f |= i % a[j] == b[j];       cnt += f;     }     cout.setf(ios::fixed, ios::floatfield);     return (cout << setprecision(7) << cnt / 1e6 << endl) && 0;   }   