#include <bits/stdc++.h>
using namespace std;
int n;
int M[20 + 2], R[20 + 2];
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);
  int ans = 0;
  for (int i = 0; i <= 10000000; i++) {
    int flag = 0;
    for (int j = 1; j <= n; ++j)
      if (i % M[j] == R[j]) {
        flag = 1;
        break;
      }
    if (flag) ans++;
  }
  printf("%.7lf\n", ans / 10000000.0);
  return 0;
}
