#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &num) {
  bool start = 0, neg = 0;
  char c;
  num = 0;
  while ((c = getchar()) != EOF) {
    if (c == '-')
      start = neg = 1;
    else if (c >= '0' && c <= '9') {
      start = 1;
      (num *= 10) += c - '0';
    } else if (start)
      break;
  }
  if (neg) num = -num;
}
int m[30], r[30];
bool bo[10000000];
int main() {
  int n;
  read(n);
  int ans = 0;
  for (int i = 1; i <= n; ++i) read(m[i]);
  for (int i = 1; i <= n; ++i) read(r[i]);
  for (int i = 1; i <= 10000000; ++i)
    for (int j = 1; j <= n; ++j)
      if (i % m[j] == r[j]) {
        ans++;
        break;
      }
  for (int j = 1; j <= 10000000; ++j) ans += bo[j];
  cout << (double)ans / 10000000;
}
