新学一个 求乘法逆元的方法。
inv[x] = ( Mod - Mod / x ) * inv[Mod%x] % Mod
设Mod=px+q. inv[x]=r
px+q = 0 (mod Mod)
pxr+qr = 0 (mod Mod)
p + qr = 0 (mod Mod)
r=-p/q= -p*inv[q] = -(Mod/x)*inv[Mod % x] = (Mod - Mod/x) * inv[Mod % x].
Every day is meaningful, keeping learning!