#include <bits/stdc++.h>
using namespace std;
int a[10001], b[10001], n;
double ans;
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (register int i = 1; i <= n; ++i) scanf("%d", &b[i]);
  for (register int i = 1; i <= 1000000; ++i) {
    for (register int j = 1; j <= n; ++j) {
      if (i % a[j] == b[j]) {
        ans += 1;
        break;
      }
    }
  }
  printf("%.6lf", ans / 1000000);
  return 0;
}
