#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll n;
ll m[20], r[20];
ll lcm;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> m[i];
  for (int i = 1; i <= n; ++i) cin >> r[i];
  lcm = m[1];
  for (int i = 2; i <= n; ++i) {
    ll g = gcd(lcm, m[i]);
    lcm *= m[i] / g;
  }
  ll ans = 0;
  for (ll i = 0; i < lcm; ++i) {
    for (int j = 1; j <= n; ++j)
      if (i % m[j] == r[j]) {
        ++ans;
        break;
      }
  }
  cout << fixed << setprecision(10) << ans * 1.0 / lcm << endl;
  return 0;
}
