#include <bits/stdc++.h>
int n, m[20], r[20], c;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &m[i]);
  for (int i = 0; i < n; i++) scanf("%d", &r[i]);
  for (int i = 0; i < 720720; i++) {
    bool you = false;
    for (int j = 0; j < n; j++)
      if (i % m[j] == r[j]) you = true;
    if (you) c++;
  }
  printf("%.6lf\n", c / 720720.);
  scanf("\n");
  return 0;
}
