← 返回题目列表

Codeforces · 656/B

B. 炒

中文机器翻译题面 查看原题

Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy.您决定使用 iDourtcne 系统。您可以继续使用 fooniwllg dael。 Yuo argee on 两个 ientgres M adn R 阵列,nmebur upmicnog dyas(induiclng teh cunrret oen)与 sicsescuve irnegets(teh ceurrnt dya is zreo),adn yuo wsah teh diehss on dya D if adn olny if terhe etsixs an iednx i scuh taht D mod M[i] = R[i],请记住它。你好,你的 rmotaome 的简单技巧可以让你保持安全,所以你可以享受一下 aemnrgeet 的乐趣。

Yuo aer geivn ayarrs M adn R. Cuaclatle teh pceanregte of dyas on which you edn up dnoig teh wisahng. Amsuse taht yuo hvae iiiftlneny dyas aehad of yuo。

输入

输入的第一行包含单个整数 N (1 ≤ N ≤ 16)。

输入的第二行和第三行各包含 N 个整数,全部在 0 到 16 之间(含),并分别表示数组 M 和 R。对于每个 i R[i] < M[i],所有 M[i] 均为正。

输出

输出单个实数。如果答案的绝对误差或相对误差不超过 10 - 4,则认为答案是正确的。

示例

输入 #1

1
2
0

输出 #1

0.500000

输入 #2

2
2 3
1 0

输出 #2

0.666667