#Lutece1697. 简单GCD问题(一)
简单GCD问题(一)
Migrated from Lutece 1697 简单GCD问题(一)
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
秦队长给你两个长度为的序列和,第个数分别为和
请你求出$\sum_{1 \leq i,j \leq n} \gcd \left ( i,j \right ) a_{i} b_{j}$的值
答案可能很大,请输出模后的结果
Input
第一行输入一个数,表示序列长度
第二行输入个数,表示序列,第个数表示
第三行输入个数,表示序列,第个数表示
Output
输出模后的答案
Samples
4
1 2 3 4
1 2 3 4
186
Resources
missever