#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> M, R;
  int N, x;
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    cin >> x;
    M.push_back(x);
  }
  for (int i = 1; i <= N; ++i) {
    cin >> x;
    R.push_back(x);
  }
  int ans = 0;
  int lim = 1e6 + 10;
  for (int i = 0; i < lim; ++i)
    for (int j = 0; j < N; ++j)
      if (i % M[j] == R[j]) {
        ++ans;
        break;
      }
  cout << fixed << setprecision(7);
  cout << (long double)ans / lim << endl;
}
