#include <bits/stdc++.h>
using namespace std;
int arr[1000000], brr[1000000];
int main() {
  long long int n;
  cin >> n;
  int mx = -1;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mx = max(mx, arr[i]);
  }
  for (int j = 0; j < n; j++) cin >> brr[j];
  int md = 0;
  for (int i = 0; i <= 1000000; i++) {
    for (int j = 0; j < n; j++) {
      if (i % arr[j] == brr[j]) {
        md++;
        break;
      }
    }
  }
  double ans = (double)md / (double)(1000000 + 1);
  printf("%.6lf", ans);
}
