#include <bits/stdc++.h>
using namespace std;
bool A[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int B[n];
  for (int i = 0; i < n; i++) cin >> B[i];
  for (int i = 0; i < n; i++) {
    while (B[i] < 1000000) {
      A[B[i]] = true;
      B[i] += arr[i];
    }
  }
  double t = accumulate(A, A + 1000000, 0.0);
  printf("%.12lf\n", t / 1000000);
  return 0;
}
