#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ret = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    ret = (ret << 1) + (ret << 3) + ch - '0';
    ch = getchar();
  }
  return ret * f;
}
int n, m[25], r[25], my;
double ans;
int main() {
  n = read();
  for (register int i = 1; i <= n; i++) m[i] = read();
  for (register int i = 1; i <= n; i++) r[i] = read();
  for (register int i = 0; i <= 1000000; i++) {
    for (register int j = 1; j <= n; j++) {
      if (i % m[j] == r[j]) {
        my++;
        break;
      }
    }
  }
  ans = my / 1000000.0;
  printf("%0.6lf\n", ans);
  return 0;
}
