#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int m[n + 3];
  int r[n + 3];
  for (int i = 0; i < n; i++) cin >> m[i];
  for (int i = 0; i < n; i++) cin >> r[i];
  int c = 0;
  for (int d = 0; d <= 10000099; d++) {
    for (int i = 0; i < n; i++) {
      if (m[i] != 0) {
        if (d % m[i] == r[i]) {
          c++;
          i = n + 190;
        }
      }
    }
  }
  double cc = (double)c;
  double nn = (double)(10000099 + 1);
  printf("%.8lf", cc / nn);
  return 0;
}
