#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e7;
int n;
int m[100], r[100];
bool am[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  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 <= n; i++) {
    bool da = 0;
    for (int k = 0; k * m[i] + r[i] < MAX; k++) am[k * m[i] + r[i]] = 1;
  }
  int cnt = 0;
  for (int i = 1; i < MAX; i++) cnt += am[i];
  cout << 1.00 * cnt / (MAX - 1);
  return 0;
}
