#include <bits/stdc++.h>
using namespace std;
int m[100], r[100];
int solve() {
  ios::sync_with_stdio(0);
  int n;
  cout.precision(30);
  if (!(cin >> n)) return 1;
  int t = 1;
  for (int i = 0; i < n; i++) {
    cin >> m[i];
    t *= m[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  int k = 0;
  t = 1000000;
  for (int i = 0; i < t; i++) {
    bool ok = false;
    for (int j = 0; j < n; j++) {
      if (i % m[j] == r[j]) {
        ok = true;
      }
    }
    if (ok) {
      k++;
    }
  }
  cout << (long double)k / (long double)t;
  return 0;
}
int32_t main() {
  int T = 1;
  for (int i = 1;; i++) {
    if (solve()) break;
  }
  return 0;
}
