#include <bits/stdc++.h>
using namespace std;
int gcd(unsigned long long int a, unsigned long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int N;
  cin >> N;
  int M[20], R[20];
  unsigned long long int lcm = 1;
  for (int i = 0; i < N; ++i) cin >> M[i];
  for (int i = 0; i < N; ++i) cin >> R[i];
  lcm = M[0];
  for (int i = 1; i < N; ++i) {
    unsigned long long int g = gcd(lcm, M[i]);
    lcm = lcm / g * M[i];
  }
  unsigned long long int counter = 0;
  for (unsigned long long int d = 0; d < lcm; ++d)
    for (int i = 0; i < N; ++i)
      if (d % M[i] == R[i]) {
        ++counter;
        break;
      }
  cout.flags(ios::fixed);
  cout << setprecision(6) << counter * 1. / lcm << endl;
  return 0;
}
