#include <bits/stdc++.h>
using namespace std;
int NOD(int a, int b) {
  if (b == 0) {
    return a;
  }
  return NOD(b, a % b);
}
int main() {
  int n = 0;
  scanf("%d", &n);
  vector<int> m(n);
  vector<int> r(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &m[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &r[i]);
  }
  int q = m[0];
  for (int i = 1; i < n; i++) {
    int w = NOD(q, m[i]);
    q = w * (q / w) * (m[i] / w);
  }
  vector<bool> e(q, false);
  for (int i = 0; i < n; i++) {
    int x = r[i];
    while (x < q) {
      e[x] = true;
      x += m[i];
    }
  }
  int k1 = 0, k2 = 0;
  for (int i = 0; i < q; i++) {
    if (e[i]) {
      k1++;
    }
  }
  cout << (double)k1 / q;
  return 0;
}
