#include <bits/stdc++.h>
using namespace std;
inline long long IN() {
  long long x = 0;
  int ch = getchar(), f = 1;
  while (!isdigit(ch) && (ch != '-') && (ch != EOF)) ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void OUT(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10)
    OUT(x / 10), putchar(x % 10 + '0');
  else
    putchar(x + '0');
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int n, M[17], R[17];
int main() {
  n = IN();
  int Sx = 1;
  for (int i = 1; i <= n; i++) M[i] = IN(), Sx = Sx * M[i] / gcd(Sx, M[i]);
  for (int i = 1; i <= n; i++) R[i] = IN();
  int Ans = 0;
  for (int i = 1; i <= Sx; i++) {
    bool F = 0;
    for (int j = 1; j <= n; j++)
      if (i % M[j] == R[j]) F = 1;
    Ans += F;
  }
  printf("%.5lf\n", 1.0 * Ans / Sx);
}
