#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  for (;;) {
    if (a == 0) return b;
    b %= a;
    if (b == 0) return a;
    a %= b;
  }
}
int lcm(int a, int b) {
  int temp = gcd(a, b);
  return temp ? (a / temp * b) : 0;
}
int main() {
  long long int n;
  cin >> n;
  int m[n];
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> m[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int result = std::accumulate(m, m + n, 1, lcm);
  int count = 0;
  for (int d = 0; d < result; d++) {
    for (int i = 0; i < n; i++) {
      if (d % m[i] == a[i]) {
        count++;
        break;
      }
    }
  }
  double res = (double)count / (double)result;
  cout << res << endl;
  return 0;
}
