#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
int nok(int a, int b) { return a * b / gcd(a, b); }
int main() {
  int n;
  cin >> n;
  int allnok = 1;
  vector<int> m(n);
  vector<int> r(n);
  for (int i = 0; i < n; i++) {
    cin >> m[i];
    allnok = nok(allnok, m[i]);
  }
  for (int j = 0; j < n; j++) {
    cin >> r[j];
  }
  int cnt = 0;
  for (int i = 0; i < allnok; i++) {
    for (int j = 0; j < n; j++) {
      if (i % m[j] == r[j]) {
        cnt++;
        break;
      }
    }
  }
  cout.precision(8);
  cout << fixed << ((double)cnt / (double)allnok);
  return 0;
}
