#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, i, n;
  long int b;
  long long c;
  string s;
  vector<int> v;
  cin >> n;
  int m[n], r[n];
  for (i = 0; i < n; i++) {
    cin >> m[i];
  }
  for (i = 0; i < n; i++) {
    cin >> r[i];
  }
  int ch[100000], j;
  memset(ch, 0, sizeof(ch));
  for (i = 0; i < n; i++) {
    for (j = 0; j < 100000; j++) {
      if (j % m[i] == r[i]) ch[j] = 1;
    }
  }
  int xx = 0;
  for (i = 0; i < 100000; i++) {
    if (ch[i]) xx++;
  }
  double ans = double(xx) / double(100000);
  printf("%0.5lf", ans);
  return 0;
}
