#include <bits/stdc++.h>
int main() {
  static bool b[100002];
  int m[16], r[16], n, i, j, count = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &m[i]);
  for (i = 0; i < n; i++) {
    scanf("%d", &r[i]);
    b[j = r[i]] = 1;
    while ((j += m[i]) <= 100000) b[j] = 1;
  }
  for (i = 0; i < 100000; i++)
    if (b[i]) count++;
  float res = count / 100000.0;
  printf("%0.6f", res);
  return 0;
}
