#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool X[100000] = {0};
  int m[n], r[n];
  for (int i = 0; i < n; ++i) {
    cin >> m[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> r[i];
  }
  for (int i = 0; i < n; ++i) {
    int x = r[i];
    while (x < 100000) {
      X[x] = 1;
      x += m[i];
    }
  }
  long long int N = 0;
  for (int i = 0; i < 100000; ++i) {
    if (X[i]) {
      N++;
    }
  }
  double f = N * 0.00001;
  printf("%lf", f);
  return 0;
}
