#include <bits/stdc++.h>
using namespace std;
int m[20];
int q[20];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> m[i];
  for (int i = 0; i < n; ++i) cin >> q[i];
  bool ok = 0;
  int cnt = 0;
  for (int i = 0; i < 102960; ++i) {
    ok = 0;
    for (int j = 0; j < n; ++j) {
      if (i % m[j] == q[j]) {
        ok = 1;
        break;
      }
    }
    if (ok) ++cnt;
  }
  double ans = (cnt)*1.0 / 102960.0;
  cout << ans << endl;
}
