#include <bits/stdc++.h>
using namespace std;
bool mark[1000501];
int main() {
  long long int t, k, n, m;
  cin >> k;
  int arr[20], brr[20];
  for (int i = 0; i < k; i++) cin >> arr[i];
  for (int i = 0; i < k; i++) cin >> brr[i];
  for (int i = 0; i <= 100050; i++) mark[i] = false;
  for (int i = 0; i < k; i++) {
    {
      int q = 1;
      while (q * arr[i] + (brr[i]) <= 100050) {
        mark[q * arr[i] + (brr[i])] = true;
        q++;
      }
    }
  }
  long long int count = 0;
  for (int i = 0; i < 100051; i++)
    if (mark[i] == true) count++;
  double ans = (double)count / 100050;
  printf("%.6lf\n", ans);
  return 0;
}
