#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> ll;
typedef vector<long long> vl;
typedef vector<ll> vll;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  long long n;
  cin >> n;
  vl a(n), b(n);
  for (long long i = (0); i < (n); i++) cin >> a[i];
  for (long long i = (0); i < (n); i++) cin >> b[i];
  long long lcm = 1;
  for (long long i = (0); i < (n); i++) {
    lcm = (lcm * a[i]) / gcd(lcm, a[i]);
  }
  long long counter = 0;
  long long j;
  for ((j) = 1; (j) < (lcm + 1); (j)++) {
    long long check = false;
    for (long long i = (0); i < (n); i++)
      if (j % a[i] == b[i]) check = true;
    if (check) counter++;
  }
  long double ans = (counter * 1.0) / lcm;
  cout << fixed << setprecision(6) << ans;
  return 0;
}
