#include <bits/stdc++.h>
using namespace std;
const int MAXN = 20;
int A[MAXN], B[MAXN], N, M = 1;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return (long long)a * b / gcd(a, b); }
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
    scanf("%d", A + i);
    M = lcm(M, A[i]);
  }
  for (int i = 0; i < N; ++i) scanf("%d", B + i);
  int cnt = 0;
  for (int i = 1; i <= M; ++i) {
    for (int j = 0; j < N; ++j) {
      if (i % A[j] == B[j]) {
        cnt++;
        break;
      }
    }
  }
  printf("%.6lf\n", double(cnt) / M);
  return 0;
}
