#include <bits/stdc++.h>
int n, a[26], b[26];
signed main() {
  scanf("%d", &n);
  int ans(0);
  for (register int i(1); i <= n; i++) scanf("%d", &a[i]);
  for (register int i(1); i <= n; i++) scanf("%d", &b[i]);
  for (register int i(1); i < 720721; i++)
    for (register int j(1); j <= n; j++)
      if (i % a[j] == b[j]) {
        ++ans;
        break;
      }
  return printf("%.6lf\n", ans / 720720.0), 0;
}
