#include <bits/stdc++.h>
using namespace std;
struct dbg_ {
  template <typename T>
  dbg_& operator,(const T& x) {
    cout << x << ' ';
    return *this;
  }
} dbg_t;
int M[17];
int R[17];
bitset<720721> x;
int mod(int a, int m) { return (a + m) % m; }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> M[i];
  for (int i = 0; i < n; i++) cin >> R[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 720721; j++) {
      if (mod(j, M[i]) == R[i]) x[j] = 1;
    }
  }
  unsigned long long int sum = 0;
  for (int j = 0; j < 720721; j++) sum += x[j];
  cout << 1.0 * sum / 720722 << endl;
  return 0;
}
