#include <bits/stdc++.h>
int m[20], r[20];
int main() {
  double n, sum = 0;
  scanf("%lf", &n);
  for (register int i = 1; i <= n; ++i) scanf("%d", &m[i]);
  for (register int i = 1; i <= n; ++i) scanf("%d", &r[i]);
  for (register int i = 0; i < 1000000; ++i)
    for (register int j = 1; j <= n; ++j)
      if (i % m[j] == r[j]) {
        ++sum;
        break;
      }
  printf("%f", sum / 1000000);
  return 0;
}
