greatest common divisor
powerMod x^e % MOD
extend gcd: find x&y st ax+by=gcd(x,y); mod inverse find x s.t. ax%n=1
matrix A^e % MOD