#include <bits/stdc++.h>
using namespace std;
int n, ans = 0, t[23], r[32];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> t[i];
  for (int i = 1; i <= n; i++) cin >> r[i];
  for (int i = 1; i <= 730000; i++) {
    for (int j = 1; j <= n; j++) {
      if (i % t[j] == r[j]) {
        ans++;
        break;
      }
    }
  }
  double sum = 1.0 * ans / 730000;
  printf("%.6lf", sum);
  return 0;
}
