#include <bits/stdc++.h>
using namespace std;
struct ty {
  int x, y;
};
int i, j, n, m[18], r[18], ct;
bool d[720722];
int main() {
  cin >> n;
  for (i = 1; i <= n; ++i) cin >> m[i];
  for (i = 1; i <= n; ++i) cin >> r[i];
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= 720720; ++j) {
      if (j % m[i] == r[i]) d[j] = true;
    }
  }
  for (i = 1; i <= 720720; ++i)
    if (d[i]) ct++;
  double ans = ct / 720720.0;
  printf("%.5f\n", ans);
  return 0;
}
