#include <bits/stdc++.h>
using namespace std;
int main() {
  cout.precision(30);
  long long n;
  cin >> n;
  vector<long long> a, b, c;
  for (long long i = 0; i < 50000; i++) {
    c.push_back(i);
  }
  for (long long i = 0; i < n; i++) {
    long long p;
    cin >> p;
    a.push_back(p);
  }
  long double k = 0;
  for (long long i = 0; i < n; i++) {
    long long p;
    cin >> p;
    b.push_back(p);
  }
  for (long long i = 0; i < c.size(); i++) {
    for (long long j = 0; j < n; j++) {
      if (i % a[j] == b[j]) {
        k++;
        break;
      }
    }
  }
  cout << k / 50000;
}
