erMod :: (Integral a, Integral t) => t -> a -> t -> t
powerMod a n m =
power f e a n = power f (if odd n then f a e else e) (f a a) (div n 2)
power f e a n = power f (if odd n then f a e else e) (f a a) (div n 2)