#include <bits/stdc++.h>
using namespace std;
double ans = 0.0F;
int n, d, m[101] = {0}, r[101] = {0};
int tmp = 0;
int main(int argc, char** argv, char** env) {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> m[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> r[i];
  }
  for (int i = 0; i < (int)1e6; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (i % m[j] == r[j]) {
        tmp++;
        break;
      }
    }
  }
  ans = tmp * 1.0F / 1e6;
  cout << fixed << setprecision(6) << ans << endl;
  return 0;
}
