#include <bits/stdc++.h>
using namespace std;
int mcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return mcd(b, a % b);
}
int mcm(int a, int b) { return (a * b) / mcd(a, b); }
int n;
int M[50], R[50];
int main() {
  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 MCM = 1;
  for (int i = 0; i < n; i++) {
    MCM = mcm(MCM, M[i]);
  }
  vector<bool> m_v(MCM);
  for (int i = 0; i < n; i++) {
    for (int j = R[i]; j < MCM; j += M[i]) m_v[j] = true;
  }
  int cont = 0;
  for (int j = 0; j < MCM; j++)
    if (m_v[j]) cont++;
  printf("%.8f\n", cont / double(MCM));
}
