#include <bits/stdc++.h>
using namespace std;
int n, m[20], r[20];
double ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &m[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &r[i]);
  for (int i = 1; i <= 720720; i++)
    for (int j = 1; j <= n; j++)
      if (i % m[j] == r[j]) {
        ans++;
        break;
      }
  printf("%.6lf", ans / 720720);
}
