#include <bits/stdc++.h>
using namespace std;
int n, sum, m[17], r[17];
double ans;
int main() {
  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 = 1; i <= 999999; i++)
    for (int j = 1; j <= n; j++)
      if (i % m[j] == r[j]) {
        sum++;
        break;
      }
  ans = 1.0 * sum / 999999;
  cout << ans;
  return 0;
}
