#include <bits/stdc++.h>
using namespace std;
long long GCD(int a, int b) {
  if (b == 0) return a;
  return GCD(b, a % b);
}
long long LCM(int a, int b) { return a / GCD(a, b) * b; }
long long LCM(int a[], int n) {
  long long lcm = a[0];
  for (int i = 1; i < (n); ++i) {
    long long g = GCD(lcm, a[i]);
    lcm = lcm * a[i] / g;
  }
  return lcm;
}
int main(int argc, char** argv) {
  int n;
  cin >> n;
  int M[20], R[20];
  for (int i = 0; i < (n); ++i) {
    cin >> M[i];
  }
  for (int i = 0; i < (n); ++i) {
    cin >> R[i];
  }
  long long maxMod = (long long)max_element(&M[0], &M[n]);
  long long lcm = LCM(M, n);
  long long tmp = 10 * lcm;
  int count = 0;
  for (int i = 0; i < (tmp); ++i) {
    for (int j = 0; j < (n); ++j) {
      if (i % M[j] == R[j]) {
        count++;
        break;
      }
    }
  }
  double per = (double)count / (double)tmp;
  printf("%.5llf", per);
  return 0;
}
