#include <bits/stdc++.h>
using namespace std;
int n;
int m[22], r[22];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> m[i];
  for (int i = 0; i < n; i++) {
    cin >> r[i];
    r[i] %= m[i];
    if (r[i] < 0) r[i] += m[i];
  }
  int s = 0;
  for (int i = 0; i < 10000000; i++) {
    int ok = 0;
    for (int j = 0; j < n; j++)
      if (i % m[j] == r[j]) {
        ok = 1;
        break;
      }
    s += ok;
  }
  double t = s / 1e7;
  printf("%.10lf\n", t);
  return 0;
}
