#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  vector<int> M(N);
  for (int i = 0; i < N; i++) cin >> M[i];
  vector<int> R(N);
  for (int i = 0; i < N; i++) cin >> R[i];
  vector<int> M2 = M;
  sort(M2.begin(), M2.end());
  long long int Dmax = 720720;
  int numD = 0;
  for (int D = 0; D < Dmax; D++) {
    for (int i = 0; i < N; i++) {
      if (D % M[i] == R[i]) {
        numD++;
        break;
      }
    }
  }
  cout << (double)numD / Dmax << endl;
  return 0;
}
