#include <bits/stdc++.h>
using namespace std;
unsigned long long aa = 1, n, m[20], r[20], k = 0;
int main() {
  cin >> 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 < 1000001; ++i) {
    for (int j = 0; j < n; ++j)
      if (i % m[j] == r[j]) {
        ++k;
        break;
      }
  }
  cout << (double)k / 1000000;
  return 0;
}
