#include <bits/stdc++.h>
using namespace std;
unsigned long long mark[720720];
pair<unsigned long long, unsigned long long> a[16];
int main() {
  unsigned long long i, j, k, n, m = 1, c = 0;
  cin >> n;
  for (i = 0; i <= n - 1; i++) scanf("%d", &a[i].first);
  for (i = 0; i <= n - 1; i++) scanf("%d", &a[i].second);
  for (i = 0; i <= n - 1; i++) {
    if (a[i].first == 0) continue;
    for (j = 0; j <= 720719; j++)
      if (j % a[i].first == a[i].second) mark[j] = 1;
  }
  c = accumulate(mark, mark + 720720, 0);
  double ans = (double)c / 720720;
  printf("%lf\n", ans);
  return 0;
}
