#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
const int mod = 1000000007;
int m[N], r[N];
int solve(int test) {
  int n;
  scanf("%d", &n);
  int tot = 1000000;
  for (int i = 0; i < n; ++i) {
    scanf("%d", m + i);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", r + i);
  }
  double ans = 0;
  for (int i = 0; i < tot; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i % m[j] == r[j]) {
        ans = ans + 1;
        break;
      }
    }
  }
  printf("%.17lf\n", ans / tot);
  return (0);
}
void allClear() {}
int main() {
  int t = 1;
  for (int _ = 1; _ <= t; ++_) {
    int ret = solve(_);
    allClear();
  }
  return (0);
}
