#include <bits/stdc++.h>
using namespace std;
const int MAXA = 1e7 + 100;
const int MAXN = 20;
int n;
int M[MAXN];
int R[MAXN];
bool CheckMod(int num, int i) {
  if (M[i] == 0) return false;
  if ((num % M[i]) == R[i]) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> M[i];
  for (int i = 0; i < n; i++) cin >> R[i];
  int wash = 0;
  for (int num = 0; num < MAXA; num++) {
    for (int i = 0; i < n; i++)
      if (CheckMod(num, i)) {
        wash++;
        break;
      }
  }
  long double ans = (((long double)wash) / MAXA);
  cout << fixed << setprecision(7) << ans << endl;
  return 0;
}
