#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e9;
long long powm(long long a, long long p, long long m) {
  long long r = 1 % m;
  while (p) {
    if (p & 1) r = r * a % m;
    p >>= 1;
    a = a * a % m;
  }
  return r;
}
int main() {
  int n, m[16], r[16];
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", m + i);
  for (int i = 0; i < n; ++i) scanf("%d", r + i);
  int tot = 10000000, good = 0;
  for (int d = 0; d < tot; ++d) {
    bool check = 0;
    for (int i = 0; i < n; ++i) check |= d % m[i] == r[i];
    good += check;
  }
  printf("%0.5lf\n", 1.0 * good / tot);
  return 0;
}
