#include <bits/stdc++.h>
int M[20], R[20], n;
inline int GCD(int x, int y) { return y == 0 ? x : GCD(y, x % y); }
inline int LCM(int x, int y) { return x / GCD(x, y) * y; }
int main() {
  scanf("%d", &n);
  scanf("%d", &M[0]);
  int lcm = M[0];
  for (int i = 1; i < n; ++i) {
    scanf("%d", &M[i]);
    lcm = LCM(lcm, M[i]);
  }
  for (int i = 0; i < n; ++i) scanf("%d", &R[i]);
  int cnt = 0;
  for (int i = 1; i <= lcm; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i % M[j] == R[j]) {
        cnt++;
        break;
      }
    }
  }
  double res = double(cnt) / double(lcm);
  printf("%.6f\n", res);
  return 0;
}
