#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a1[20], a2[20];
  double num, sum = 0;
  cin >> num;
  for (int i = 1; i <= num; i++) {
    cin >> a1[i - 1];
  }
  for (int i = 1; i <= num; i++) {
    cin >> a2[i - 1];
  }
  for (int q = 1; q <= 1000000; q++) {
    for (int w = 1; w <= num; w++) {
      if ((q - 1) % a1[w - 1] == a2[w - 1]) {
        sum++;
        break;
      }
    }
  }
  cout << setprecision(6) << fixed << sum / 1000000 << endl;
  return 0;
}
